hedgewars/uLandGraphics.pas
changeset 1861 98de5dc5fda7
parent 1849 2a989e5abda6
child 1892 fddc1201df25
--- a/hedgewars/uLandGraphics.pas	Wed Mar 04 16:35:36 2009 +0000
+++ b/hedgewars/uLandGraphics.pas	Thu Mar 05 14:54:02 2009 +0000
@@ -67,26 +67,34 @@
    begin
    if ((y + dy) and LAND_HEIGHT_MASK) = 0 then
       for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
-          if (Land[y + dy, i] > 0) then dec(Land[y + dy, i]); // check > 0 because explosion can erase collision data
+          if (Land[y + dy, i] > 0) and (Land[y + dy, i] < 256) then dec(Land[y + dy, i]); // check > 0 because explosion can erase collision data
    if ((y - dy) and LAND_HEIGHT_MASK) = 0 then
       for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
-          if (Land[y - dy, i] > 0) then dec(Land[y - dy, i]);
+          if (Land[y - dy, i] > 0) and (Land[y - dy, i] < 256) then dec(Land[y - dy, i]);
    if ((y + dx) and LAND_HEIGHT_MASK) = 0 then
       for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
-          if (Land[y + dx, i] > 0) then dec(Land[y + dx, i]);
+          if (Land[y + dx, i] > 0) and (Land[y + dx, i] < 256) then dec(Land[y + dx, i]);
    if ((y - dx) and LAND_HEIGHT_MASK) = 0 then
       for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
-          if (Land[y - dx, i] > 0) then dec(Land[y - dx, i]);
+          if (Land[y - dx, i] > 0) and (Land[y - dx, i] < 256) then dec(Land[y - dx, i]);
    end else
    begin
    if ((y + dy) and LAND_HEIGHT_MASK) = 0 then
-      for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do inc(Land[y + dy, i]);
+      for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do 
+          if (Land[y + dy, i] < 256) then
+              inc(Land[y + dy, i]);
    if ((y - dy) and LAND_HEIGHT_MASK) = 0 then
-      for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do inc(Land[y - dy, i]);
+      for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do 
+          if (Land[y - dy, i] < 256) then
+              inc(Land[y - dy, i]);
    if ((y + dx) and LAND_HEIGHT_MASK) = 0 then
-      for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do inc(Land[y + dx, i]);
+      for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
+          if (Land[y + dx, i] < 256) then
+              inc(Land[y + dx, i]);
    if ((y - dx) and LAND_HEIGHT_MASK) = 0 then
-      for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do inc(Land[y - dx, i]);
+      for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
+          if (Land[y - dx, i] < 256) then
+              inc(Land[y - dx, i]);
    end
 end;