# HG changeset patch
# User nemo
# Date 1388464127 18000
# Node ID 5a0a7ef7af2dbc8a5db492a67345a6ee9710bd26
# Parent  c9dc04e325e30fb370368546e0cd346c7f04bee9
allow SDL 1.2 to at least do a 32767 map.  We probably should add a TryDo somewhere to assert that limit on SDL 1.2 to avoid overflows.  Ditto int version for SDL 2

diff -r c9dc04e325e3 -r 5a0a7ef7af2d hedgewars/uLand.pas
--- a/hedgewars/uLand.pas	Tue Dec 31 04:56:16 2013 +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