<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40327 >
Attached patch should fix your issue, as well as the case of the client not updating the city owner correctly when an enemy city is captured. There seems to be a proliferation of side-effect laden hacks through-out this section of the code (both in the client and in the server), so it is possible I have broken someone's not entirely beneficial assumptions elsewhere with this fix. Though I tested obvious cases using savegames and the editor with no ill outcomes, something could be lurking just outside the usual code paths. :}-- So if you would test this patch and notify me of any inconsistencies it would be helpful, otherwise I will test it myself some more and hopefully commit it soon. ---------------------------------------------------------------------- 醜いところを見つけたら、なぜいつも同じ人のせいだろうか。
>From 5daaa2af22eca2e95300f5d0c079ff95c188ef71 Mon Sep 17 00:00:00 2001 From: Madeline Book <[EMAIL PROTECTED]> Date: Thu, 31 Jul 2008 19:14:19 -0400 Subject: [PATCH] Do not use tile_owner in city info packet handlers. - Check changes in city owner using city_owner(pcity) rather than against tile_owner(ptile). - Remove calls to tile_set_owner in city info packet handlers. - Fix formatting and style of multi-assignements. --- client/packhand.c | 19 ++++++------------- 1 files changed, 6 insertions(+), 13 deletions(-) diff --git a/client/packhand.c b/client/packhand.c index 5fa615c..52944e1 100644 --- a/client/packhand.c +++ b/client/packhand.c @@ -503,14 +503,12 @@ void handle_city_info(struct packet_city_info *packet) city_list_unlink(invisible_cities, pcity); city_is_new = TRUE; - pcity->tile = + pcity->tile = pcenter; ptile = pcenter; - pcity->owner = + pcity->owner = powner; pcity->original = powner; - tile_set_owner(pcenter, powner); - } else if (tile_owner(ptile) != powner) { - /* assumes the tile properly reflects city_owner() */ + } else if (city_owner(pcity) != powner) { client_remove_city(pcity); pcity = NULL; city_has_changed_owner = TRUE; @@ -520,7 +518,6 @@ void handle_city_info(struct packet_city_info *packet) if (NULL == pcity) { city_is_new = TRUE; pcity = create_city_virtual(powner, pcenter, packet->name); - tile_set_owner(pcenter, powner); pcity->id = packet->id; idex_register_city(pcity); update_descriptions = TRUE; @@ -829,14 +826,11 @@ void handle_city_short_info(struct packet_city_short_info *packet) city_list_unlink(invisible_cities, pcity); city_is_new = TRUE; - pcity->tile = + pcity->tile = pcenter; ptile = pcenter; - pcity->owner = + pcity->owner = powner; pcity->original = powner; - - tile_set_owner(pcenter, powner); - } else if (tile_owner(ptile) != powner) { - /* assumes the tile properly reflects city_owner() */ + } else if (city_owner(pcity) != powner) { client_remove_city(pcity); pcity = NULL; city_has_changed_owner = TRUE; @@ -846,7 +840,6 @@ void handle_city_short_info(struct packet_city_short_info *packet) if (NULL == pcity) { city_is_new = TRUE; pcity = create_city_virtual(powner, pcenter, packet->name); - tile_set_owner(pcenter, powner); pcity->id = packet->id; idex_register_city(pcity); } else if (pcity->id != packet->id) { -- 1.5.5.1
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev