Loop sweeping to avoid stray pixels. Avoided at first hoping there was a cleverer approach. Fortunately sweep is infrequent.
--- a/hedgewars/uLandGraphics.pas Mon Jun 15 14:02:48 2009 +0000
+++ b/hedgewars/uLandGraphics.pas Mon Jun 15 21:03:57 2009 +0000
@@ -439,7 +439,7 @@
function SweepDirty: boolean;
var x, y, xx, yy: LongInt;
- Result, updateBlock: boolean;
+ Result, updateBlock, resweep: boolean;
begin
Result:= false;
@@ -451,13 +451,19 @@
if LandDirty[y, x] <> 0 then
begin
updateBlock:= false;
- for yy:= y * 32 to y * 32 + 31 do
- for xx:= x * 32 to x * 32 + 31 do
- if Despeckle(xx, yy) then
- begin
- Result:= true;
- updateBlock:= true;
- end;
+ resweep:= true;
+ while(resweep) do
+ begin
+ resweep:= false;
+ for yy:= y * 32 to y * 32 + 31 do
+ for xx:= x * 32 to x * 32 + 31 do
+ if Despeckle(xx, yy) then
+ begin
+ Result:= true;
+ updateBlock:= true;
+ resweep:= true;
+ end;
+ end;
if updateBlock then UpdateLandTexture(x * 32, 32, y * 32, 32);
LandDirty[y, x]:= 0;
end;