Add more border checks
authornemo
Thu, 10 Nov 2011 15:12:44 -0500
changeset 6314 b4fc5b863f5f
parent 6313 12567f6f6f02
child 6315 1f7a7a330c59
Add more border checks
hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc	Thu Nov 10 12:20:01 2011 -0500
+++ b/hedgewars/GSHandlers.inc	Thu Nov 10 15:12:44 2011 -0500
@@ -1285,8 +1285,7 @@
             inc(i, 1)
             end;
 
-        if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9)
-           , lfIndestructible) then
+        if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9), lfIndestructible) then
             begin
             Gear^.X := Gear^.X + Gear^.dX;
             Gear^.Y := Gear^.Y + _1_9;
@@ -1301,14 +1300,20 @@
         end
     else
         begin
-        Gear^.dY := Gear^.dY + cGravity;
-        Gear^.Y := Gear^.Y + Gear^.dY;
+        if CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y + Gear^.dY + cGravity), lfIndestructible) then
+            begin
+            Gear^.dY := Gear^.dY + cGravity;
+            Gear^.Y := Gear^.Y + Gear^.dY
+            end;
         if hwRound(Gear^.Y) > cWaterLine then Gear^.Timer := 1
         end;
 
     Gear^.X := Gear^.X + HHGear^.dX;
-    HHGear^.X := Gear^.X;
-    HHGear^.Y := Gear^.Y - int2hwFloat(cHHRadius);
+    if CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y)-cHHRadius, lfIndestructible) then
+        begin
+        HHGear^.X := Gear^.X;
+        HHGear^.Y := Gear^.Y - int2hwFloat(cHHRadius)
+        end;
 
     if (Gear^.Message and gmAttack) <> 0 then
         if (Gear^.State and gsttmpFlag) <> 0 then Gear^.Timer := 1