Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] (PR#12081) veteran status in icon not updated
Home

[Freeciv-Dev] (PR#12081) veteran status in icon not updated

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: chrisk@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#12081) veteran status in icon not updated
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 1 Mar 2005 14:23:55 -0800
Reply-to: bugs@xxxxxxxxxxx

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

> [chrisk - Wed Feb 02 15:03:06 2005]:
> 
> 
> CVS 02 FEB 2005 S2 GTK2
> 
> The veteran status display in the unit icon is not updated, in case you
> attack an enemy unit, loose, and the enemy unit becomes (more) veteran.

Indeed, the make_veteran field of the combat_info packet is simply
ignored.  Here are patches for both branches (untested however).  How
can we test this - do you have a savegame for the problem?

-jason

Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.408.2.19
diff -u -r1.408.2.19 packhand.c
--- client/packhand.c   8 Feb 2005 18:07:29 -0000       1.408.2.19
+++ client/packhand.c   1 Mar 2005 22:22:48 -0000
@@ -269,6 +269,8 @@
   struct unit *punit1 = find_unit_by_id(defender_unit_id);
 
   if (punit0 && punit1) {
+    struct unit *pwinner = (defender_hp == 0 ? punit0 : punit1);
+
     if (tile_visible_mapcanvas(punit0->tile) &&
        tile_visible_mapcanvas(punit1->tile)) {
       show_combat = TRUE;
@@ -291,14 +293,26 @@
       if (do_combat_animation) {
        flush_dirty();
        decrease_unit_hp_smooth(punit0, hp0, punit1, hp1);
+       if (make_winner_veteran) {
+         pwinner->veteran++;
+         refresh_tile_mapcanvas(pwinner->tile, FALSE);
+       }
       } else {
        punit0->hp = hp0;
        punit1->hp = hp1;
 
        set_units_in_combat(NULL, NULL);
+       if (make_winner_veteran) {
+         pwinner->veteran++;
+       }
        refresh_tile_mapcanvas(punit0->tile, FALSE);
        refresh_tile_mapcanvas(punit1->tile, FALSE);
       }
+    } else {
+      if (make_winner_veteran) {
+       pwinner->veteran++;
+       refresh_tile_mapcanvas(pwinner->tile, FALSE);
+      }
     }
   }
 }
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.473
diff -u -r1.473 packhand.c
--- client/packhand.c   23 Feb 2005 03:34:05 -0000      1.473
+++ client/packhand.c   1 Mar 2005 22:16:05 -0000
@@ -300,6 +300,12 @@
        refresh_unit_mapcanvas(punit1, punit1->tile, TRUE, FALSE);
       }
     }
+    if (make_winner_veteran) {
+      struct unit *pwinner = (defender_hp == 0 ? punit0 : punit1);
+
+      pwinner->veteran++;
+      refresh_unit_mapcanvas(pwinner, pwinner->tile, TRUE, FALSE);
+    }
   }
 }
 
Index: server/unithand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unithand.c,v
retrieving revision 1.323
diff -u -r1.323 unithand.c
--- server/unithand.c   23 Feb 2005 03:34:06 -0000      1.323
+++ server/unithand.c   1 Mar 2005 22:16:06 -0000
@@ -619,7 +619,7 @@
   combat.defender_unit_id=pdefender->id;
   combat.attacker_hp=pattacker->hp;
   combat.defender_hp=pdefender->hp;
-  combat.make_winner_veteran=veteran;
+  combat.make_winner_veteran = (veteran != 0);
 
   players_iterate(other_player) {
     if (map_is_known_and_seen(pattacker->tile, other_player)

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12081) veteran status in icon not updated, Jason Short <=