hedgewars/uLand.pas
changeset 3617 1df21e06b8ba
parent 3612 b50215a8a43d
child 3630 2c7a9d5aa18c
--- a/hedgewars/uLand.pas	Sat Jul 03 04:42:29 2010 +0200
+++ b/hedgewars/uLand.pas	Sat Jul 03 05:51:24 2010 +0200
@@ -1300,7 +1300,7 @@
 end;
 
 function GenPreview: TPreview;
-var x, y, xx, yy, t, bit: LongInt;
+var x, y, xx, yy, t, bit, cbit, lh, lw: LongInt;
     Preview: TPreview;
 begin
     WriteLnToConsole('Generating preview...');
@@ -1309,6 +1309,8 @@
         1: GenMaze;
     end;
 
+    lh:= LAND_HEIGHT div 128;
+    lw:= LAND_WIDTH div 32;
     for y:= 0 to 127 do
         for x:= 0 to 31 do
         begin
@@ -1316,8 +1318,9 @@
             for bit:= 0 to 7 do
             begin
                 t:= 0;
-                for yy:= y * (LAND_HEIGHT div 128) to y * (LAND_HEIGHT div 128) + 7 do
-                    for xx:= x * (LAND_WIDTH div 32) + bit * 8 to x * (LAND_WIDTH div 32) + bit * 8 + 7 do
+                cbit:= bit * 8;
+                for yy:= y * lh to y * lh + 7 do
+                    for xx:= x * lw + cbit to x * lw + cbit + 7 do
                         if Land[yy, xx] <> 0 then inc(t);
                 if t > 8 then
                     Preview[y, x]:= Preview[y, x] or ($80 shr bit);