merge
authorkoda
Mon, 21 Jun 2010 22:18:53 +0200
changeset 3527 c4e0ef164162
parent 3525 1d7b056ff866 (current diff)
parent 3521 96a502730e81 (diff)
child 3532 04e2fea3e83a
merge
--- a/hedgewars/uLandGraphics.pas	Sun Jun 20 23:05:11 2010 +0200
+++ b/hedgewars/uLandGraphics.pas	Mon Jun 21 22:18:53 2010 +0200
@@ -644,7 +644,7 @@
 function Despeckle(X, Y: LongInt): boolean;
 var nx, ny, i, j, c: LongInt;
 begin
-if (Land[Y, X] > 255) and ((Land[Y, X] and lfIndestructible) = 0) and ((Land[Y, X] and lfDamaged) <> 0)then // check neighbours
+if ((Land[Y, X] and lfDamaged) <> 0) and ((Land[Y, X] and lfIndestructible) = 0) then // check neighbours
     begin
     c:= 0;
     for i:= -1 to 1 do
--- a/hedgewars/uLandObjects.pas	Sun Jun 20 23:05:11 2010 +0200
+++ b/hedgewars/uLandObjects.pas	Mon Jun 21 22:18:53 2010 +0200
@@ -211,23 +211,27 @@
 end;
 
 function CheckLand(rect: TSDL_Rect; dX, dY, Color: Longword): boolean;
-var i: LongInt;
+var i, tmpx, tmpy, bx, by: LongInt;
     bRes: boolean = true;
 begin
 inc(rect.x, dX);
 inc(rect.y, dY);
+bx:= rect.x + rect.w;
+by:= rect.y + rect.h;
 i:= 0;
 {$WARNINGS OFF}
-while (i <= rect.w) and bRes do
+tmpx:= rect.x;
+while (tmpx <= bx) and bRes do
       begin
-      bRes:= (Land[rect.y, rect.x + i] = Color) and (Land[rect.y + rect.h, rect.x + i] = Color);
-      inc(i)
+      bRes:= (Land[rect.y, tmpx] = Color) and (Land[by, tmpx] = Color);
+      inc(tmpx)
       end;
 i:= 0;
-while (i <= rect.h) and bRes do
+tmpy:= rect.y;
+while (tmpy <= by) and bRes do
       begin
-      bRes:= (Land[rect.y + i, rect.x] = Color) and (Land[rect.y + i, rect.x + rect.w] = Color);
-      inc(i)
+      bRes:= (Land[tmpy, rect.x] = Color) and (Land[tmpy, bx] = Color);
+      inc(tmpy)
       end;
 {$WARNINGS ON}
 CheckLand:= bRes;