Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2005:
[Freeciv-Dev] (PR#12080) L(oaded) icon update
Home

[Freeciv-Dev] (PR#12080) L(oaded) icon update

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: chrisk@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#12080) L(oaded) icon update
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 4 Feb 2005 22:45:19 -0800
Reply-to: bugs@xxxxxxxxxxx

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

> [chrisk - Wed Feb 02 14:48:47 2005]:
> 
> 
> CVS 02 FEB 2005 S2 GTK2
> 
> Given a city with a transport and 4 land units (unloaded and sentried).
> Have another unit unloaded and active in the city.
> 
> Using load command from context menu in city dialog will update the
left bar
> units display, but *not* the units display within the city dialog.
Close and
> reopen will show the correct icons there, too.

This patch should solve this and other refresh problems.

Basically any time we have to repaint the unit we need to repaint the
city it is occupying and the homecity as well.  However there are some
actions that would cause only a city refresh to be needed.

This should work for both branches.  Please test.

-jason

? blend.png
? fog
? fog.c
? fog.png
? foo
? terrain1.png
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.463
diff -u -r1.463 packhand.c
--- client/packhand.c   4 Feb 2005 23:00:02 -0000       1.463
+++ client/packhand.c   5 Feb 2005 06:44:46 -0000
@@ -1156,10 +1156,16 @@
        repaint_city = TRUE;
       }
     } output_type_iterate_end;
-    if (repaint_city) {
+    if (repaint_city || repaint_unit) {
+      /* We repaint the city if the unit itself needs repainting or if
+       * there a special city-only redrawing to be done. */
       if((pcity=find_city_by_id(punit->homecity))) {
        refresh_city_dialog(pcity);
       }
+      if (repaint_unit && punit->tile->city && punit->tile->city != pcity) {
+       /* Refresh the city we're occupying too. */
+       refresh_city_dialog(punit->tile->city);
+      }
     }
 
     punit->veteran = packet_unit->veteran;
? patch.diff
? win32.diff
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.408.2.17
diff -u -r1.408.2.17 packhand.c
--- client/packhand.c   19 Jan 2005 05:32:44 -0000      1.408.2.17
+++ client/packhand.c   5 Feb 2005 06:44:44 -0000
@@ -1185,10 +1185,16 @@
       punit->upkeep_gold = packet_unit->upkeep_gold;
       repaint_city = TRUE;
     }
-    if (repaint_city) {
+    if (repaint_city || repaint_unit) {
+      /* We repaint the city if the unit itself needs repainting or if
+       * there a special city-only redrawing to be done. */
       if((pcity=find_city_by_id(punit->homecity))) {
        refresh_city_dialog(pcity);
       }
+      if (repaint_unit && punit->tile->city && punit->tile->city != pcity) {
+       /* Refresh the city we're occupying too. */
+       refresh_city_dialog(punit->tile->city);
+      }
     }
 
     punit->veteran = packet_unit->veteran;

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