Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2005:
[Freeciv-Dev] (PR#12189) inefficiency in switch_city_callback
Home

[Freeciv-Dev] (PR#12189) inefficiency in switch_city_callback

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12189) inefficiency in switch_city_callback
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 9 Feb 2005 10:23:59 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12189 >

THere is this code to find the "next" city:

   for (i = 0; i < size; i++) {
     if (pdialog->pcity == city_list_get(game.player_ptr->cities, i)) {
       break;
     }
   }

problem is city_list_get is Real Slow so this is O(n^2).  Could be a 
problem on huge maps.

-jason





[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12189) inefficiency in switch_city_callback, Jason Short <=