Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2004:
[Freeciv-Dev] (PR#7242) Unit in city flag not updated when unit leaving
Home

[Freeciv-Dev] (PR#7242) Unit in city flag not updated when unit leaving

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: ue80@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#7242) Unit in city flag not updated when unit leaving city
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 18 Jan 2004 09:54:12 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7242 >

> [ue80@xxxxxxxxxxxxxxxxxxxxx - Wed Jan 14 13:44:32 2004]:
> 
> Hi,
> 
> when moving a unit out of a city the flag which shows if a unit is in
> the city isn't updated. (Flag shows that there is a unit) after
> refocusing the flag disappears.
> 
> gtk-2.0 client current cvs. Think it's related to the science dialog
> error.

It's not related to the science dialog error.

The attached patch fixes it.

jason

Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.343
diff -u -r1.343 packhand.c
--- client/packhand.c   2004/01/11 17:45:03     1.343
+++ client/packhand.c   2004/01/18 17:53:17
@@ -1043,9 +1043,14 @@
         * logic is a little shaky since it's not clear whether we can
         * see the internals of the city or not; however, the server should
         * send us a city update to clear things up. */
-       pcity->client.occupied =
-           (unit_list_size(&(map_get_tile(pcity->x, pcity->y)->units)) > 0);
+       bool new_occupied =
+         (unit_list_size(&(map_get_tile(pcity->x, pcity->y)->units)) > 0);
 
+       if (pcity->client.occupied != new_occupied) {
+         pcity->client.occupied = new_occupied;
+         refresh_tile_mapcanvas(pcity->x, pcity->y, FALSE);
+       }
+
         if(pcity->id==punit->homecity)
          repaint_city = TRUE;
        else
@@ -1054,7 +1059,10 @@
       
       if((pcity=map_get_city(punit->x, punit->y)))  {
        /* Unit moved into a city - obviously it's occupied. */
-       pcity->client.occupied = TRUE;
+       if (!pcity->client.occupied) {
+         pcity->client.occupied = TRUE;
+         refresh_tile_mapcanvas(pcity->x, pcity->y, FALSE);
+       }
 
         if(pcity->id == punit->homecity)
          repaint_city = TRUE;

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