hedgewars/uLand.pas
branch0.9.20
changeset 9891 89e74808836d
parent 9864 f7eb0d87c9b6
child 9950 2759212a27de
child 9998 736015b847e3
--- a/hedgewars/uLand.pas	Fri Jan 03 01:40:50 2014 +0100
+++ b/hedgewars/uLand.pas	Mon Dec 30 23:28:47 2013 -0500
@@ -190,19 +190,22 @@
 procedure ColorizeLand(Surface: PSDL_Surface);
 var tmpsurf: PSDL_Surface;
     r: TSDL_Rect;
+    y: LongWord; // stupid SDL 1.2 uses stupid SmallInt for y which limits us to 32767.  But is even worse if LandTex is large, can overflow on 32767 map.
 begin
     tmpsurf:= LoadDataImage(ptCurrTheme, 'LandTex', ifCritical or ifIgnoreCaps);
     r.y:= 0;
-    while r.y < LAND_HEIGHT do
-    begin
+    y:= 0;
+    while y < LAND_HEIGHT do
+        begin
         r.x:= 0;
         while r.x < LAND_WIDTH do
-        begin
+            begin
             SDL_UpperBlit(tmpsurf, nil, Surface, @r);
             inc(r.x, tmpsurf^.w)
+            end;
+        inc(y, tmpsurf^.h);
+        r.y:= y
         end;
-        inc(r.y, tmpsurf^.h)
-    end;
     SDL_FreeSurface(tmpsurf);
 
     // freed in freeModule() below