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

> [guest - Tue Jul 22 22:34:42 2008]:
> Attached patch will let the cities be visible
> in the fog after you viewed them with a unit or
> something else. Note that if you test it on a
> savegame affected by the current bug you will
> have to give the client the chance to get an
> update on the city list by the server. E.g. with
> the GTK client and current editor available
> just press key combos: "<ctrl> + e", "<ctrl> +
> f" and "<ctrl> + e" again.
> One strange new "bug" I discovered with this is
> that at first load of the given save game and
> above mentioned procedure to reload the city
> list I can see the cities in the fog but the
> name-bars will remain hidden. At first I thought
> this would be a new feature hidden yet due to
> the given bug. However, if I save the game,
> kill the client and server, restarting it all
> again and then loading the just saved game I'll
> get the cities and their names displayed in the
> fog again, just like it used to be in S2_1.

When compiling I get:

mapview_common.c: In function `put_one_tile':
mapview_common.c:1073: warning: implicit declaration of function 

i.e. there is a missing #include "game.h" in that
file. Be sure to compile with --enable-debug so
the compile stops on such warnings. ;)

Your patch appears to work, but the approach is
not very good, for two reasons.

First is that it is very inefficient; you are
iterating over all the player's cities every
time that 'if' condition in put_one_tile is met.
As the game progresses and the player knows
about more cities and reveals more of the map
it will get slower and slower. Generally, the
drawing code is the bottleneck in freeciv (at
least on the client side), so we do not want to
make it slower.

(Incidentally, why not just pass the tile pointer
instead of int x, y? The tile pointer uniquely
identifies the tile so checking ptile == pcity->tile
should have the same effect as the code in your

Secondly, conceptually tile_city and your
game_find_city_by_xy_pos should always return
the same result, that is the whole point of
keeping the city pointer in the tile struct.
The fact that something like your function
would be needed means that there is a problem
somewhere else, perhaps in the client's updating
of this field, or the server's sending of it.

So this issue needs more investigating. :(


Freeciv-dev mailing list

Reply via email to