hedgewars/uGearsList.pas
changeset 15215 f783f5d55717
parent 15151 6b7d92fa4912
child 15227 deaa316af414
--- a/hedgewars/uGearsList.pas	Mon Jul 01 22:35:19 2019 +0200
+++ b/hedgewars/uGearsList.pas	Tue Jul 02 15:23:16 2019 +0200
@@ -873,15 +873,17 @@
         Gear^.Hedgehog^.Gear:= nil;
 
         if Gear^.Hedgehog^.King then
+            // If king died, kill the rest of the team
             begin
-            Gear^.Hedgehog^.Team^.hasKing:= false;
-            for i:= 0 to Pred(team^.Clan^.TeamsNumber) do
-                with team^.Clan^.Teams[i]^ do
-                    for t:= 0 to cMaxHHIndex do
-                        if Hedgehogs[t].Gear <> nil then
-                            Hedgehogs[t].Gear^.Health:= 0
-                        else if (Hedgehogs[t].GearHidden <> nil) then
-                            Hedgehogs[t].GearHidden^.Health:= 0  // hog is still hidden. if tardis should return though, lua, eh...
+            with Gear^.Hedgehog^.Team^ do
+                begin
+                Gear^.Hedgehog^.Team^.hasKing:= false;
+                for t:= 0 to cMaxHHIndex do
+                    if Hedgehogs[t].Gear <> nil then
+                        Hedgehogs[t].Gear^.Health:= 0
+                    else if (Hedgehogs[t].GearHidden <> nil) then
+                        Hedgehogs[t].GearHidden^.Health:= 0  // Hog is still hidden. If tardis should return though, Lua, eh ...
+                end;
             end;
 
         // Update passive status of clan