[Freeciv-Dev] bugfix: conquered city strangeness
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
I discovered a bug in recent cvs whereby sometimes if someone
conquers a city of yours, a city dialog pops up for the just
conquered city, or a duplicate of the conquered city, or ...
And the city is still in your city report. (Specifically, if
the city supports units outside the city.)
It turns out that this happens because in cityhand.c:remove_city(),
we send PACKET_REMOVE_CITY before removing the city's units.
Due to a recent change, removing a unit now refreshes its home
city (to update the upkeep etc), and the refresh has the effect
of making the client recreate its copy of the just destroyed city!
The attached fix simply removes any supported units before
sending PACKET_REMOVE_CITY.
Regards,
-- David
diff -u -r --exclude-from exclude freeciv-cvs/server/cityhand.c
freeciv-mod/server/cityhand.c
--- freeciv-cvs/server/cityhand.c Mon Mar 1 19:15:44 1999
+++ freeciv-mod/server/cityhand.c Sat Mar 27 00:12:08 1999
@@ -674,15 +674,15 @@
gamelog(GAMELOG_LOSEC,"%s lose %s (%i,%i)",
get_race_name_plural(game.players[pcity->owner].race),
pcity->name,pcity->x,pcity->y);
+ while(unit_list_size(&pcity->units_supported)) {
+ wipe_unit(0, unit_list_get(&pcity->units_supported,0));
+ }
for (o=0; o<4; o++)
remove_trade_route(pcity->trade[o], pcity->id);
packet.value=pcity->id;
for(o=0; o<game.nplayers; o++) /* dests */
send_packet_generic_integer(game.players[o].conn,
PACKET_REMOVE_CITY,&packet);
- while(unit_list_size(&pcity->units_supported)) {
- wipe_unit(0, unit_list_get(&pcity->units_supported,0));
- }
remove_city_from_cache(pcity->id);
dealloc_id(pcity->id);
x = pcity->x; y = pcity->y;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] bugfix: conquered city strangeness,
David Pfitzner <=
|
|