tweak to avoid specks after damage
authornemo
Thu, 09 Jun 2011 00:00:33 -0400
changeset 5231 29a3a9309f2c
parent 5230 c088be28d5e8
child 5232 fdfd63ac11fb
tweak to avoid specks after damage
hedgewars/uLand.pas
--- a/hedgewars/uLand.pas	Wed Jun 08 23:25:05 2011 -0400
+++ b/hedgewars/uLand.pas	Thu Jun 09 00:00:33 2011 -0400
@@ -1063,28 +1063,30 @@
         for x:= leftX+2 to rightX-2 do
             for y:= topY+2 to LAND_HEIGHT-3 do
                 if (Land[y, x] = 0) and 
-                   (((Land[y, x-1] <> 0) and ((Land[y+1,x]<>0)) or (Land[y-1,x]<>0)) or
-                   ((Land[y, x+1] <> 0) and ((Land[y-1,x]<>0) or (Land[y+1,x]<>0)))) then
+                   (((Land[y, x-1] = lfBasic) and ((Land[y+1,x] = lfBasic)) or (Land[y-1,x] = lfBasic)) or
+                   ((Land[y, x+1] = lfBasic) and ((Land[y-1,x] = lfBasic) or (Land[y+1,x] = lfBasic)))) then
                 begin
-                    if Land[y, x-1] <> 0 then LandPixels[y, x]:= LandPixels[y, x-1]
-                    else if Land[y, x+1] <> 0 then LandPixels[y, x]:= LandPixels[y, x+1];
-                    LandPixels[y,x]:= (LandPixels[y,x] and not AMask) or (128 shl AShift)
+                    if Land[y, x-1] = lfBasic then LandPixels[y, x]:= LandPixels[y, x-1]
+                    else if Land[y, x+1] = lfBasic then LandPixels[y, x]:= LandPixels[y, x+1];
+                    LandPixels[y,x]:= (LandPixels[y,x] and not AMask) or (128 shl AShift);
+                    Land[y,x]:= lfObject
                 end
                 else if (Land[y, x] = 0) and
-                        (((Land[y, x-1] <> 0) and (Land[y+1,x-1]<>0) and (Land[y+2,x]<>0)) or
-                        ((Land[y, x-1] <> 0) and (Land[y-1,x-1]<>0) and (Land[y-2,x]<>0)) or
-                        ((Land[y, x+1] <> 0) and (Land[y+1,x+1]<>0) and (Land[y+2,x]<>0)) or
-                        ((Land[y, x+1] <> 0) and (Land[y-1,x+1]<>0) and (Land[y-2,x]<>0)) or
-                        ((Land[y+1, x] <> 0) and (Land[y+1,x+1]<>0) and (Land[y,x+2]<>0)) or
-                        ((Land[y-1, x] <> 0) and (Land[y-1,x+1]<>0) and (Land[y,x+2]<>0)) or
-                        ((Land[y+1, x] <> 0) and (Land[y+1,x-1]<>0) and (Land[y,x-2]<>0)) or
-                        ((Land[y-1, x] <> 0) and (Land[y-1,x-1]<>0) and (Land[y,x-2]<>0))) then
+                        (((Land[y, x-1] = lfBasic) and (Land[y+1,x-1] = lfBasic) and (Land[y+2,x] = lfBasic)) or
+                        ((Land[y, x-1] = lfBasic) and (Land[y-1,x-1] = lfBasic) and (Land[y-2,x] = lfBasic)) or
+                        ((Land[y, x+1] = lfBasic) and (Land[y+1,x+1] = lfBasic) and (Land[y+2,x] = lfBasic)) or
+                        ((Land[y, x+1] = lfBasic) and (Land[y-1,x+1] = lfBasic) and (Land[y-2,x] = lfBasic)) or
+                        ((Land[y+1, x] = lfBasic) and (Land[y+1,x+1] = lfBasic) and (Land[y,x+2] = lfBasic)) or
+                        ((Land[y-1, x] = lfBasic) and (Land[y-1,x+1] = lfBasic) and (Land[y,x+2] = lfBasic)) or
+                        ((Land[y+1, x] = lfBasic) and (Land[y+1,x-1] = lfBasic) and (Land[y,x-2] = lfBasic)) or
+                        ((Land[y-1, x] = lfBasic) and (Land[y-1,x-1] = lfBasic) and (Land[y,x-2] = lfBasic))) then
                 begin
-                    if Land[y, x-1] <> 0 then LandPixels[y, x]:= LandPixels[y, x-1]
-                    else if Land[y, x+1] <> 0 then LandPixels[y, x]:= LandPixels[y, x+1]
-                    else if Land[y+1, x] <> 0 then LandPixels[y, x]:= LandPixels[y+1, x]
-                    else if Land[y-1, x] <> 0 then LandPixels[y, x]:= LandPixels[y-1, x];
-                    LandPixels[y,x]:= (LandPixels[y,x] and not AMask) or (64 shl AShift)
+                    if Land[y, x-1] = lfBasic then LandPixels[y, x]:= LandPixels[y, x-1]
+                    else if Land[y, x+1] = lfBasic then LandPixels[y, x]:= LandPixels[y, x+1]
+                    else if Land[y+1, x] = lfBasic then LandPixels[y, x]:= LandPixels[y+1, x]
+                    else if Land[y-1, x] = lfBasic then LandPixels[y, x]:= LandPixels[y-1, x];
+                    LandPixels[y,x]:= (LandPixels[y,x] and not AMask) or (64 shl AShift);
+                    Land[y,x]:= lfObject
                 end;
     AddProgress();
 end;