Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2005:
[Freeciv-Dev] (PR#11819) Occupied city flag removed after breaking an al
Home

[Freeciv-Dev] (PR#11819) Occupied city flag removed after breaking an al

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11819) Occupied city flag removed after breaking an alliance
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Fri, 7 Jan 2005 06:10:10 -0800
Reply-to: bugs@xxxxxxxxxxx

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

> [jdorje - Fri Jan 07 05:05:31 2005]:
> 
> > [mstefek - Thu Jan 06 11:35:23 2005]:
> > 
> > (beta6)
> > Load attached game, press turn done, cancel alliance with slovenians.
> > The occupied flag is erronously removed from ljublana.
> > 
> > I don't know what causes this. remove_allied_visibility() is supposed to 
> > send new updated short city packet. I don't see a bug there.
> 
> In a 2.0 pubserver game the other day I saw a city that looked
> unoccupied, but turned out to be occupied when I attacked.  So the
> occupied-city bug is surely alive and well.  (I had been allied to the
> player some time earlier.)
> 
> -jason
> 
Caught.
First of all the dump city packet isn't sent by delta, because nothing changes 
in fact.

If a client receives unit_goes_out_of_sight packet and the unit is in a city, 
the client checks if it is allied to the city owner. If there's no alliance the 
flag is never removed.

This sounds ok so far. The bug is actually in the server code which sends 
unit_goes_out_of_sight packet before sending new diplomatic state.

The attached patch fixes the bug.
--
mateusz
--- f2orig/server/plrhand.c     2004-12-21 23:57:27.000000000 +0100
+++ freeciv2/server/plrhand.c   2005-01-07 15:01:56.000000000 +0100
@@ -1167,6 +1167,10 @@
   /* If the old state was alliance, the players' units can share tiles
      illegally, and we need to call resolve_unit_stacks() */
   if (old_type == DS_ALLIANCE) {
+    /* The client needs updated diplomatic state, because it is used
+     * during calculation of new states of occupied flags in cities */
+    send_player_info(pplayer, NULL);
+    send_player_info(pplayer2, NULL);
     remove_allied_visibility(pplayer, pplayer2);
     remove_allied_visibility(pplayer2, pplayer);    
     resolve_unit_stacks(pplayer, pplayer2, TRUE);

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