hedgewars/uTeams.pas
changeset 7990 891b78af1a04
parent 7980 7f8df51553a7
child 8026 4a4f21070479
child 8054 39f8ea1a441f
--- 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;