TestRectForObstacle: areas outside map borders are not passable
authorsheepluva
Fri, 16 Sep 2011 00:18:21 +0200
changeset 5919 f737843dd331
parent 5918 f2cd4d15465b
child 5920 32c0c0d37b6a
TestRectForObstacle: areas outside map borders are not passable
hedgewars/uCollisions.pas
--- a/hedgewars/uCollisions.pas	Thu Sep 15 23:08:17 2011 +0200
+++ b/hedgewars/uCollisions.pas	Fri Sep 16 00:18:21 2011 +0200
@@ -373,6 +373,9 @@
     y2 := y;
 end;
 
+if (hasBorder and ((y1 < 0) or (x1 < 0) or (x2 > LAND_WIDTH))) then
+    exit(true);
+
 for y := y1 to y2 do
     for x := x1 to x2 do
         if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0)