remove all portal specific code from EndTurnCleanup(), instead have portals self destruct if "CurrentHedgehog" is not the portal's creator
authorsheepluva
Mon, 17 May 2010 06:26:06 +0000
changeset 3471 e1f1ab5dfd8f
parent 3470 2b0c88693535
child 3472 b1832a3761e6
remove all portal specific code from EndTurnCleanup(), instead have portals self destruct if "CurrentHedgehog" is not the portal's creator
hedgewars/GSHandlers.inc
hedgewars/uGears.pas
--- a/hedgewars/GSHandlers.inc	Mon May 17 02:54:56 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Mon May 17 06:26:06 2010 +0000
@@ -3156,6 +3156,7 @@
     // destroy portal if ground it was attached too is gone
     if ((Land[hwRound(Gear^.Y), hwRound(Gear^.X)] and $FF00) = 0)
        or (Gear^.Timer < 1)
+       or (PHedgehog(Gear^.Hedgehog) <> CurrentHedgehog)
        or (hwRound(Gear^.Y) > cWaterLine) then
     begin
         deleteGear(Gear);
@@ -3304,7 +3305,8 @@
 end;
 
 begin
-    if (Gear^.Timer < 1) then
+    if (Gear^.Timer < 1)
+       or (PHedgehog(Gear^.Hedgehog) <> CurrentHedgehog) then
     begin
         deleteGear(Gear);
         EXIT;
--- a/hedgewars/uGears.pas	Mon May 17 02:54:56 2010 +0000
+++ b/hedgewars/uGears.pas	Mon May 17 06:26:06 2010 +0000
@@ -823,7 +823,6 @@
 //If any of these are set as permanent toggles in the frontend, that needs to be checked and skipped here.
 procedure EndTurnCleanup;
 var  i: LongInt;
-    iterator: PGear;
 begin
     SpeechText:= ''; // in case it has not been consumed
 
@@ -857,12 +856,6 @@
                      if (GameFlags and gfInvulnerable) = 0 then
                         Gear^.Invulnerable:= false;
                   end;
-    iterator:= GearsList;
-    while iterator <> nil do
-        begin
-        if (iterator^.Kind = gtPortal) then iterator^.Timer:= 0;
-        iterator:= iterator^.NextGear;
-        end;
 end;
 
 procedure ApplyDamage(Gear: PGear; Damage: Longword);