hedgewars/uLandGraphics.pas
changeset 2167 4e9ad395c1d1
parent 1892 fddc1201df25
child 2235 79c9542c1058
equal deleted inserted replaced
2166:95f1f4d37e86 2167:4e9ad395c1d1
   437 Despeckle:= false
   437 Despeckle:= false
   438 end;
   438 end;
   439 
   439 
   440 function SweepDirty: boolean;
   440 function SweepDirty: boolean;
   441 var x, y, xx, yy: LongInt;
   441 var x, y, xx, yy: LongInt;
   442     Result, updateBlock: boolean;
   442     Result, updateBlock, resweep: boolean;
   443 begin
   443 begin
   444 Result:= false;
   444 Result:= false;
   445 
   445 
   446 for y:= 0 to LAND_HEIGHT div 32 - 1 do
   446 for y:= 0 to LAND_HEIGHT div 32 - 1 do
   447 	begin
   447 	begin
   449 	for x:= 0 to LAND_WIDTH div 32 - 1 do
   449 	for x:= 0 to LAND_WIDTH div 32 - 1 do
   450 		begin
   450 		begin
   451 		if LandDirty[y, x] <> 0 then
   451 		if LandDirty[y, x] <> 0 then
   452 			begin
   452 			begin
   453 			updateBlock:= false;
   453 			updateBlock:= false;
   454 			for yy:= y * 32 to y * 32 + 31 do
   454             resweep:= true;
   455 				for xx:= x * 32 to x * 32 + 31 do
   455             while(resweep) do
   456 					if Despeckle(xx, yy) then
   456                 begin
   457 						begin
   457                 resweep:= false;
   458 						Result:= true;
   458                 for yy:= y * 32 to y * 32 + 31 do
   459 						updateBlock:= true;
   459                     for xx:= x * 32 to x * 32 + 31 do
   460 						end;
   460                         if Despeckle(xx, yy) then
       
   461                             begin
       
   462                             Result:= true;
       
   463                             updateBlock:= true;
       
   464                             resweep:= true;
       
   465                             end;
       
   466                 end;
   461 			if updateBlock then UpdateLandTexture(x * 32, 32, y * 32, 32);
   467 			if updateBlock then UpdateLandTexture(x * 32, 32, y * 32, 32);
   462 			LandDirty[y, x]:= 0;
   468 			LandDirty[y, x]:= 0;
   463 			end;
   469 			end;
   464 		end;
   470 		end;
   465 	end;
   471 	end;