hedgewars/uCollisions.pas
changeset 10354 56bd029245fc
parent 10108 c68cf030eded
child 10494 0eb97cf4c78e
--- a/hedgewars/uCollisions.pas	Sat Jul 05 18:51:45 2014 +0200
+++ b/hedgewars/uCollisions.pas	Sat Jul 05 20:15:56 2014 +0200
@@ -54,6 +54,8 @@
 
 function  TestRectancleForObstacle(x1, y1, x2, y2: LongInt; landOnly: boolean): boolean;
 
+function  CheckCoordInWater(X, Y: LongInt): boolean; inline;
+
 // returns: negative sign if going downhill to left, value is steepness (noslope/error = _0, 45 = _0_5)
 function  CalcSlopeBelowGear(Gear: PGear): hwFloat;
 function  CalcSlopeNearGear(Gear: PGear; dirX, dirY: LongInt): hwFloat;
@@ -112,6 +114,12 @@
     end;
 end;
 
+function CheckCoordInWater(X, Y: LongInt): boolean; inline;
+begin
+    CheckCoordInWater:= (Y > cWaterLine)
+        or ((WorldEdge = weSea) and ((X < leftX) or (X > rightX)));
+end;
+
 function CheckGearsCollision(Gear: PGear): PGearArray;
 var mx, my, tr: LongInt;
     i: Longword;