hedgewars/uAIMisc.pas
changeset 10354 56bd029245fc
parent 10164 0570d4b22187
child 10510 9329dab04490
--- a/hedgewars/uAIMisc.pas	Sat Jul 05 18:51:45 2014 +0200
+++ b/hedgewars/uAIMisc.pas	Sat Jul 05 20:15:56 2014 +0200
@@ -445,7 +445,7 @@
                     end;
             exit(0)
             end;
-        if (y > cWaterLine) or (x > rightX) or (x < leftX) then exit(-1)
+        if CheckCoordInWater(round(x), round(y)) then exit(-1)
         end
 end;
 
@@ -497,7 +497,7 @@
                     end;
             exit(0)
         end;
-        if (y > cWaterLine) or (x > rightX) or (x < leftX) then
+        if CheckCoordInWater(round(x), round(y)) then
             // returning -1 for drowning so it can be considered in the Rate routine
             exit(-1)
     end;
@@ -876,7 +876,7 @@
             UpdateLandTexture(hwRound(Gear^.X), 1, hwRound(Gear^.Y), 1, true);
             end;}
 
-    if not (hwRound(Gear^.Y) + cHHRadius < cWaterLine) then
+    if CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y) + cHHRadius) then
         exit(false);
     if (Gear^.State and gstMoving) <> 0 then
     begin
@@ -941,7 +941,7 @@
 
     pX:= hwRound(Gear^.X);
     pY:= hwRound(Gear^.Y);
-    if pY + cHHRadius >= cWaterLine then
+    if CheckCoordInWater(pX, pY + cHHRadius) then
         begin
         if AltGear^.Hedgehog^.BotLevel < 4 then
             AddWalkBonus(pX, tY, 250, -40);