Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2004:
[Freeciv-Dev] Re: (PR#8773) rewrite city_map_iterate
Home

[Freeciv-Dev] Re: (PR#8773) rewrite city_map_iterate

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#8773) rewrite city_map_iterate
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxxx>
Date: Sat, 22 May 2004 16:30:05 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8773 >

On Sat, 22 May 2004, Jason Short wrote:

> PR#1233.
> 
> This patch is quite outdated.  Generally I find when looking for 
> inspiration it's better to go straight to Ross's full corecleanups patch 
> (a patch from ~2 years ago is still in incoming).  Do a cvs up -D and 
> apply the patch, then look at the code you're wondering about.

Ok, I remember it from corecleanups.

> Using an array solution is fine with me, but someone has to code it. 
> And the method used in the corecleanups (a compile-time-generated array) 
> is no good since these iterators may (in future) vary by topology, 
> CITY_MAP_RADIUS, or even per-city.  This is not easy to deal with in an 
> array solution.  Finally the claim that it is substantially faster than 
> a (possibly inline) mathematical calculation has not actually been 
> demonstrated.

For easy handling of CITY_MAP_RADIUS (whether city-dependent or not), you 
need to iterate outward with a stop index depending on CITY_MAP_RADIUS.  
Different topology would require either different arrays or iteration in 
some common coordinates.  The former is preferable for speed and will 
hopefully deter proliferation of new topologies ;)

As for the speed issue, we should have some trials.  Note that changing 
iteration order will likely cause AI games to diverge.

G.




[Prev in Thread] Current Thread [Next in Thread]