fix overflow check in airmine handling
authoralfadur
Fri, 02 Nov 2018 01:58:27 +0300
changeset 14065 aa586aadd91f
parent 14064 12bfae554de5
child 14066 649ccb9f8cfd
fix overflow check in airmine handling
hedgewars/uGearsHandlersMess.pas
--- a/hedgewars/uGearsHandlersMess.pas	Thu Nov 01 22:54:01 2018 +0100
+++ b/hedgewars/uGearsHandlersMess.pas	Fri Nov 02 01:58:27 2018 +0300
@@ -2103,9 +2103,10 @@
         tX:=Gear^.X-targ^.X;
         tY:=Gear^.Y-targ^.Y;
         // allow escaping - should maybe flag this too
-        if (GameTicks > Gear^.FlightTime+10000) or 
-            ((tX.Round+tY.Round > Gear^.Angle*6) and
-            (hwRound(hwSqr(tX) + hwSqr(tY)) > sqr(Gear^.Angle*6))) then
+        if (GameTicks > Gear^.FlightTime + 10000) or
+            (not ((abs(tX.Round) + abs(tY.Round) < Gear^.Angle * 9) and
+                  (hwRound(hwSqr(tX) + hwSqr(tY)) < sqr(Gear^.Angle * 6))))
+             then
             targ:= nil
         end;