hedgewars/uWorld.pas
changeset 5294 67278f1cba2c
parent 5247 bf6d4bc531d2
parent 5285 af4dc03dd60d
child 5302 eaa445230124
child 5341 479b4108789a
--- a/hedgewars/uWorld.pas	Tue Jun 21 16:43:05 2011 +0400
+++ b/hedgewars/uWorld.pas	Thu Jun 23 21:19:43 2011 +0400
@@ -528,8 +528,8 @@
 var i, w, h, lw, lh, rw, rh, sw: LongInt;
 begin
     sw:= round(cScreenWidth / cScaleFactor);
-    if (SpritesData[sprL].Texture = nil) or (SpritesData[sprR].Texture = nil) then
-    begin
+    if ((SpritesData[sprL].Texture = nil) or (SpritesData[sprR].Texture = nil)) and (SpritesData[spr].Texture <> nil) then
+        begin
         w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale;
         h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale;
         i:= Shift mod w;
@@ -539,9 +539,9 @@
             DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale);
             inc(i, w)
         until i > sw
-    end
-    else
-    begin
+        end
+    else if SpritesData[spr].Texture <> nil then
+        begin
         w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale;
         h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale;
         lw:= SpritesData[sprL].Width * SpritesData[spr].Texture^.Scale;
@@ -553,18 +553,18 @@
 
         i:= Shift - lw;
         while i >= -sw - lw do
-        begin
+            begin
             DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - lh, SpritesData[sprL].Texture, SpritesData[sprL].Texture^.Scale);
             dec(i, lw);
-        end;
+            end;
 
         i:= Shift + w;
         while i <= sw do
-        begin
+            begin
             DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - rh, SpritesData[sprR].Texture, SpritesData[sprR].Texture^.Scale);
             inc(i, rw)
+            end
         end
-    end
 end;