hedgewars/uLand.pas
changeset 10661 0da243c01bde
parent 10626 2562797ab3cf
child 10717 0810826cdf80
--- a/hedgewars/uLand.pas	Thu Dec 11 17:50:05 2014 +0100
+++ b/hedgewars/uLand.pas	Thu Dec 11 20:46:45 2014 +0100
@@ -578,10 +578,19 @@
 
 if hasBorder then
     begin
-    for y:= 0 to LAND_HEIGHT - 1 do
-        for x:= 0 to LAND_WIDTH - 1 do
-            if (y < topY) or (x < leftX) or (x > rightX) then
+    if WorldEdge = weNone then
+        begin
+        for y:= 0 to LAND_HEIGHT - 1 do
+            for x:= 0 to LAND_WIDTH - 1 do
+                if (y < topY) or (x < leftX) or (x > rightX) then
+                    Land[y, x]:= lfIndestructible;
+        end
+    else if topY > 0 then
+        begin
+        for y:= 0 to LongInt(topY) - 1 do
+            for x:= 0 to LAND_WIDTH - 1 do
                 Land[y, x]:= lfIndestructible;
+        end;
     // experiment hardcoding cave
     // also try basing cave dimensions on map/template dimensions, if they exist
     for w:= 0 to 5 do // width of 3 allowed hogs to be knocked through with grenade
@@ -666,7 +675,9 @@
 
 PrettifyLandAlpha();
 
-InitWorldEdges();
+// adjust world edges for borderless maps
+if (WorldEdge <> weNone) and (not hasBorder) then
+    InitWorldEdges();
 
 end;