<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40316 >
[EMAIL PROTECTED]: Hi, 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.
diff -Nur -X.diff_ignore trunk/client/mapview_common.c changed/client/mapview_common.c --- trunk/client/mapview_common.c 2008-07-20 13:05:16.000000000 +0200 +++ changed/client/mapview_common.c 2008-07-22 23:54:45.000000000 +0200 @@ -1070,7 +1070,8 @@ || (editor_is_active() && editor_tile_is_selected(ptile))) { put_one_element(pcanvas, layer, ptile, NULL, NULL, get_drawable_unit(tileset, ptile, citymode), - tile_city(ptile), canvas_x, canvas_y, citymode); + game_find_city_by_xy_pos(ptile->x, ptile->y), + canvas_x, canvas_y, citymode); } } diff -Nur -X.diff_ignore trunk/common/game.c changed/common/game.c --- trunk/common/game.c 2008-07-20 13:03:35.000000000 +0200 +++ changed/common/game.c 2008-07-23 00:20:15.000000000 +0200 @@ -135,6 +135,22 @@ return idex_lookup_city(id); } +/************************************************************************** + Helper function to find a city by its X and Y cartesian (map) coordinates, + will return NULL if no city is found on the given coordinates +***************************************************************************/ +struct city *game_find_city_by_xy_pos(int posX, int posY) +{ + players_iterate(pplayer) { + city_list_iterate(pplayer->cities, pcity) { + if (pcity->tile->x == posX && pcity->tile->y == posY) { + return pcity; + } + } city_list_iterate_end; + } players_iterate_end; + return NULL; +} + /************************************************************************** Find unit out of all units in game: now uses fast idex method, diff -Nur -X.diff_ignore trunk/common/game.h changed/common/game.h --- trunk/common/game.h 2008-07-20 13:03:35.000000000 +0200 +++ changed/common/game.h 2008-07-22 23:40:22.000000000 +0200 @@ -121,6 +121,7 @@ int civ_population(const struct player *pplayer); struct city *game_find_city_by_name(const char *name); struct city *game_find_city_by_number(int id); +struct city *game_find_city_by_xy_pos(int posX, int posY); struct unit *game_find_unit_by_number(int id);
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev