[Freeciv-Dev] (PR#12080) L(oaded) icon update
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12080 >
> [chrisk - Thu Mar 17 22:36:39 2005]:
> 2nd key: in the left bar, both transports show the '+'-sign in the
icon, but
> only one has units loaded.
I had some time ago made this patch to fix this problem, but I can't
find it in RT. So here it is again. Comments in patch should make it
self-explanatory. For both branches.
-jason
Index: client/control.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/control.c,v
retrieving revision 1.166
diff -u -r1.166 control.c
--- client/control.c 31 Mar 2005 17:28:02 -0000 1.166
+++ client/control.c 1 Apr 2005 00:26:47 -0000
@@ -457,29 +457,17 @@
**************************************************************************/
void update_unit_pix_label(struct unit *punit)
{
- 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;
/* Check for any change in the unit's state. This assumes that a unit's
* orders cannot be changed directly but must be removed and then reset. */
if (punit && get_client_state() != CLIENT_GAME_OVER_STATE) {
- 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;
- }
+ /* There used to be a complicated and bug-prone check here to see if
+ * the unit had actually changed. This was misguided since the stacked
+ * units (below) are redrawn in any case. Unless we write a general
+ * system for unit updates here we might as well just redraw it every
+ * time. */
+ set_unit_icon(-1, punit);
i = 0; /* index into unit_below_canvas */
unit_list_iterate(punit->tile->units, aunit) {
@@ -500,13 +488,7 @@
set_unit_icon(i, NULL);
}
}
- }
- else {
- prev_unit_type = U_LAST;
- prev_activity = ACTIVITY_UNKNOWN;
- prev_has_orders = FALSE;
- prev_veteran = -1;
- prev_hp = -1;
+ } else {
for(i=-1; i<num_units_below; i++) {
set_unit_icon(i, NULL);
}
|
|