hedgewars/uGearsHedgehog.pas
changeset 13404 3d6aae2ae698
parent 13329 543ab994c9bc
child 13468 f1d349a52bc7
--- a/hedgewars/uGearsHedgehog.pas	Tue May 22 17:54:07 2018 -0400
+++ b/hedgewars/uGearsHedgehog.pas	Wed May 23 20:45:42 2018 -0400
@@ -788,7 +788,6 @@
 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
@@ -851,12 +850,9 @@
         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;
+    if (Gear^.Message and (gmLeft or gmRight) <> 0) and (Gear^.State and gstMoving = 0) and 
+		(CheckGearNear(Gear, gtPortal, 26, 26) <> nil) then 
+		Gear^.PortalCounter:= 0;
     PrevdX:= hwSign(Gear^.dX);
     if (Gear^.Message and gmLeft  )<>0 then
         Gear^.dX:= -cLittle else