Don't zero TeamHealth, only show empty health bar
authorunc0rr
Tue, 06 Nov 2012 23:59:58 +0400
changeset 7990 891b78af1a04
parent 7988 4b428183d946
child 7992 0b7dc27b2baf
Don't zero TeamHealth, only show empty health bar
hedgewars/uTeams.pas
--- a/hedgewars/uTeams.pas	Tue Nov 06 23:33:25 2012 +0400
+++ b/hedgewars/uTeams.pas	Tue Nov 06 23:59:58 2012 +0400
@@ -447,16 +447,18 @@
 begin
 with team^ do
     begin
-    NewTeamHealthBarWidth:= 0;
+    TeamHealth:= 0;
+    for i:= 0 to cMaxHHIndex do
+        if Hedgehogs[i].Gear <> nil then
+            inc(TeamHealth, Hedgehogs[i].Gear^.Health)
+        else if Hedgehogs[i].GearHidden <> nil then
+            inc(TeamHealth, Hedgehogs[i].GearHidden^.Health);
 
     if not hasGone then
-        for i:= 0 to cMaxHHIndex do
-            if Hedgehogs[i].Gear <> nil then
-                inc(NewTeamHealthBarWidth, Hedgehogs[i].Gear^.Health)
-            else if Hedgehogs[i].GearHidden <> nil then
-                inc(NewTeamHealthBarWidth, Hedgehogs[i].GearHidden^.Health);
+        NewTeamHealthBarWidth:= TeamHealth
+        else
+        NewTeamHealthBarWidth:= 0;
 
-    TeamHealth:= NewTeamHealthBarWidth;
     if NewTeamHealthBarWidth > MaxTeamHealth then
         begin
         MaxTeamHealth:= NewTeamHealthBarWidth;