Complete.Org: Mailing Lists: Archives: freeciv-dev: March 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: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Mon, 28 Mar 2005 11:50:05 -0800
Reply-to: bugs@xxxxxxxxxxx

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

> [jdorje - Wed Mar 16 19:46:35 2005]:
> 
> > [chrisk - Tue Mar 15 17:23:02 2005]:
> > 
> > 
> > PR#12080 contains several problems with the icon update.
> > 
> > The first has been fixed.
> > 
> > I have changed status from 'fixed' to 'open'.
> > 
> > Here is another reproducible problem. I load savegame up to RT:
> > 
> > Open city of Minneapolis. You see two sentried units. Using 'load'
> > command from the context menue will *not* show the 'L' icon.
> 
> Good report.  I believe this patch fixes the problem (for both branches).
> 
> -jason
> 
With your patch unit transported_by field is updated only if the
activity changes. And refresh_unit_city_dialogs() is called with old data.

I think this patch is better. It moves refresh code outside if block,
which is supposed to do something else. Also refresh_unit_city_dialogs()
is called with updated data.
--
mateusz
Index: packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.484
diff -u -r1.484 packhand.c
--- packhand.c  28 Mar 2005 17:14:57 -0000      1.484
+++ packhand.c  28 Mar 2005 19:47:37 -0000
@@ -954,6 +954,7 @@
   bool check_focus = FALSE;     /* conservative focus change */
   bool moved = FALSE;
   bool ret = FALSE;
+  int old_transported_by;
   
   punit = player_find_unit_by_id(get_player(packet_unit->owner),
                                 packet_unit->id);
@@ -961,7 +962,6 @@
   if (punit) {
     ret = TRUE;
     punit->activity_count = packet_unit->activity_count;
-    punit->transported_by = packet_unit->transported_by;
     punit->occupy = packet_unit->occupy;
     if (punit->ai.control != packet_unit->ai.control) {
       punit->ai.control = packet_unit->ai.control;
@@ -1032,22 +1032,24 @@
       if (punit->owner == game.player_idx) {
         refresh_unit_city_dialogs(punit);
       }
+    } /*** End of Change in activity or activity's target. ***/
 
-      if (punit->transported_by != packet_unit->transported_by) {
-       struct unit *ptrans;
-
-       if (punit->transported_by != -1
-           && (ptrans = find_unit_by_id(punit->transported_by))) {
-         refresh_unit_city_dialogs(ptrans);
-       }
+    old_transported_by = punit->transported_by;
+    punit->transported_by = packet_unit->transported_by;
+    if (old_transported_by != packet_unit->transported_by) {
+      struct unit *ptrans;
+      if (old_transported_by != -1
+       && (ptrans = find_unit_by_id(old_transported_by))) {
+       refresh_unit_city_dialogs(ptrans);
+      }
 
-       if (packet_unit->transported_by != -1
-           && (ptrans = find_unit_by_id(packet_unit->transported_by))) {
-         refresh_unit_city_dialogs(ptrans);
-       }
+      if (packet_unit->transported_by != -1
+          && (ptrans = find_unit_by_id(packet_unit->transported_by))) {
+       refresh_unit_city_dialogs(ptrans);
       }
+    }
+
 
-    } /*** End of Change in activity or activity's target. ***/
     
     /* These two lines force the menus to be updated as appropriate when
      * the focus unit changes. */

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