[Freeciv-Dev] Re: (PR#8773) rewrite city_map_iterate
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<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.
|
|