Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2004:
[Freeciv-Dev] (PR#10859) unit icon in panel not updated
Home

[Freeciv-Dev] (PR#10859) unit icon in panel not updated

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: chrisk@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#10859) unit icon in panel not updated
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 4 Nov 2004 10:28:02 -0800
Reply-to: rt@xxxxxxxxxxx

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

> [chrisk - Wed Nov 03 19:59:38 2004]:

> > Can you report it in a new ticket with more explanation?
> 
> That's easy. Use the savegame arminius+1842m.sav.gz from bug reports
> PR#8737 or PR#10857, respectivly. Go through the active units with 'w'
> key.
> watch the icon for the active unit in the left panel. The unit icons
> are
> displayed with a bug: the veteran status is not always presentent
> correctly
> in the icon. It does not change.

Good report.  Here's a patch.

IMO this is a pretty crappy way to do it.  We're hard-coding what stuff
the tilespec code is going to draw.  But I'm not sure how to do it better.

jason

Index: client/control.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/control.c,v
retrieving revision 1.147
diff -u -r1.147 control.c
--- client/control.c    28 Oct 2004 02:56:25 -0000      1.147
+++ client/control.c    4 Nov 2004 18:22:42 -0000
@@ -408,6 +408,7 @@
   static enum unit_activity prev_activity = ACTIVITY_UNKNOWN;
   static bool prev_has_orders = FALSE;
   static Unit_Type_id prev_unit_type = U_LAST;
+  static int prev_veteran = -1;
   static int prev_hp = -1;              /* or could store ihp cf tilespec.c */
   
   int i;
@@ -418,11 +419,13 @@
     if (punit->type != prev_unit_type
        || punit->activity != prev_activity
        || punit->has_orders != prev_has_orders
+       || punit->veteran != prev_veteran
        || punit->hp != prev_hp) {
       set_unit_icon(-1, punit);
       prev_unit_type = punit->type;
       prev_activity = punit->activity;
       prev_has_orders = punit->has_orders;
+      prev_veteran = punit->veteran;
       prev_hp = punit->hp;
     }
 
@@ -450,6 +453,7 @@
     prev_unit_type = U_LAST;
     prev_activity = ACTIVITY_UNKNOWN;
     prev_has_orders = FALSE;
+    prev_veteran = -1;
     prev_hp = -1;
     for(i=-1; i<num_units_below; i++) {
       set_unit_icon(i, NULL);

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