Re: [Freeciv-Dev] [patch] kludge cleanup
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Trent Piepho wrote:
>
> > Solution?
> > Perhaps put a definition for find_city_by_id() in city.c,
> > as a simple wrapper to game_find_city_by_id(), but with
> > the definition controlled by a #define which is off in
> > freeciv but can be turned on to be able to compile civworld?
>
> I think when the fast find_city_by_id() was first written, I had it setup
> so it would detect if it was being run in the server or not, and use the
> appropriate code. I don't remember exactly how this all works and I'm
> away from my source. I wonder, is there anyreason not to have the client
> use the lookup table like the server does?
I think there is no in-principle reason the client can't have
its own lookup table, but currently the lookup table is setup
and maintained in the server. Doing so in the client would be
somewhat different, due to different creation/etc of cities
in the client vs the server, but should be doable.
Probably there should be a module in common/ which does the
lookup table stuff, with hooks so that the client and server can
setup and maintain the lookup table as appropriate. (And maybe
a fallback to the slow methods if the lookup table is never
initialized.)
It should also be possible for such a module to handle unit
ids in the the same way, speeding up similar searchs for units.
-- David
|
|