King Mode: Fix whole clan being killed when king died
authorWuzzy <Wuzzy2@mail.ru>
Tue, 02 Jul 2019 15:23:16 +0200
changeset 15231 f783f5d55717
parent 15230 fe79f62ef158
child 15232 924f7e38815e
King Mode: Fix whole clan being killed when king died
hedgewars/uGearsList.pas
--- 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