update land texture /after/ smoothing
authorsheepluva
Mon, 01 Dec 2014 23:09:35 +0100
changeset 10601 3f4964eeaf01
parent 10600 e28d86fc393e
child 10602 1ec0268f28af
update land texture /after/ smoothing
hedgewars/uLandGraphics.pas
--- a/hedgewars/uLandGraphics.pas	Mon Dec 01 19:24:40 2014 +0100
+++ b/hedgewars/uLandGraphics.pas	Mon Dec 01 23:09:35 2014 +0100
@@ -983,7 +983,7 @@
 
 function SweepDirty: boolean;
 var x, y, xx, yy, ty, tx: LongInt;
-    bRes, updateBlock, resweep, recheck: boolean;
+    bRes, resweep, recheck: boolean;
 begin
 bRes:= false;
 reCheck:= true;
@@ -997,7 +997,6 @@
             begin
             if LandDirty[y, x] = 1 then
                 begin
-                updateBlock:= false;
                 resweep:= true;
                 ty:= y * 32;
                 tx:= x * 32;
@@ -1009,7 +1008,6 @@
                             if Despeckle(xx, yy) then
                                 begin
                                 bRes:= true;
-                                updateBlock:= true;
                                 resweep:= true;
                                 if (yy = ty) and (y > 0) then
                                     begin
@@ -1033,9 +1031,6 @@
                                     end
                                 end;
                     end;
-                if updateBlock then
-                    UpdateLandTexture(tx, 32, ty, 32, false);
-                LandDirty[y, x]:= 2;
                 end;
             end;
         end;
@@ -1045,7 +1040,6 @@
     for x:= 0 to LAND_WIDTH div 32 - 1 do
         if LandDirty[y, x] <> 0 then
             begin
-            LandDirty[y, x]:= 0;
             ty:= y * 32;
             tx:= x * 32;
             for yy:= ty to ty + 31 do
@@ -1053,6 +1047,16 @@
                     Smooth(xx,yy)
             end;
 
+for y:= 0 to LAND_HEIGHT div 32 - 1 do
+    for x:= 0 to LAND_WIDTH div 32 - 1 do
+        if LandDirty[y, x] <> 0 then
+            begin
+            LandDirty[y, x]:= 0;
+            ty:= y * 32;
+            tx:= x * 32;
+            UpdateLandTexture(tx, 32, ty, 32, false);
+            end;
+
 SweepDirty:= bRes;
 end;