hedgewars/uGearsHedgehog.pas
changeset 10435 4c8fc3aa9432
parent 10354 56bd029245fc
child 10443 42dadeb6e8ae
--- a/hedgewars/uGearsHedgehog.pas	Thu Oct 09 22:14:55 2014 +0400
+++ b/hedgewars/uGearsHedgehog.pas	Sun Oct 19 15:46:09 2014 -0400
@@ -750,6 +750,7 @@
 procedure HedgehogStep(Gear: PGear);
 var PrevdX: LongInt;
     CurWeapon: PAmmo;
+    portals: PGearArrayS;
 begin
 CurWeapon:= GetCurAmmoEntry(Gear^.Hedgehog^);
 if ((Gear^.State and (gstAttacking or gstMoving)) = 0) then
@@ -812,6 +813,12 @@
         exit
         end;
 
+    if (Gear^.Message and (gmLeft or gmRight) <> 0) and (Gear^.State and gstMoving = 0) then
+        begin
+        // slightly inefficient since it doesn't halt after one portal, maybe could add a param to GearsNear for number desired.
+        portals:= GearsNear(Gear^.X, Gear^.Y, gtPortal, 26);
+        if portals.size = 0 then Gear^.PortalCounter:= 0
+        end;
     PrevdX:= hwSign(Gear^.dX);
     if (Gear^.Message and gmLeft  )<>0 then
         Gear^.dX:= -cLittle else