Complete.Org: Mailing Lists: Archives: freeciv-dev: January 1999:
Re: [Freeciv-Dev] [patch] kludge cleanup
Home

Re: [Freeciv-Dev] [patch] kludge cleanup

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: Re: [Freeciv-Dev] [patch] kludge cleanup
From: Per Mathisen <permath@xxxxxxxxxxx>
Date: Sun, 31 Jan 1999 13:37:57 +0100 (MET)

On Sat, 30 Jan 1999, David Pfitzner wrote:
> Hmm, sneaking in other fixes?  :-)

Oops. I forgot to reverse that patch... really :)

It is supposed to fix coredumps when no valid DISPLAY 
variable is set.

> This is bad.  In the server, find_city_by_id is O(1)
> whereas game_find_city_by_id is O(N_all_cities), and
> the above is in an often-used function.

Okay. Hmm.. strange that it worked so fine for me :) 

How about creating a new bool_find_city_by_id in common/ ?

> There is a reason Syela wrote:
> 
> > -struct city *find_city_by_id(int id);
> >  /* this funct is no longer in this module, but leaving it proto'd
> >  here saves more headaches than you can imagine -- Syela */

Yeah, but it is bad because you cannot use libcivcommon without adding 
a lot of kludges to your code.

> 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?

Well, that would work, but it does not make for readable code...

> I consider declaring variables with storage in header files bad.
> That is, the header should have "extern int is_server;"
> and the "int is_server" should be in shared.c

Ok.

Yours,
Per



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