this should allow overriding static maps from lua
authornemo
Sat, 12 Nov 2011 21:44:26 -0500
changeset 6339 2a3925178178
parent 6337 84e7d1a5e3df
child 6342 4b8f497a01da
this should allow overriding static maps from lua
hedgewars/uCommandHandlers.pas
hedgewars/uScript.pas
--- a/hedgewars/uCommandHandlers.pas	Sat Nov 12 21:59:10 2011 +0100
+++ b/hedgewars/uCommandHandlers.pas	Sat Nov 12 21:44:26 2011 -0500
@@ -453,8 +453,16 @@
 begin
 if isDeveloperMode then
     begin
-    UserPathz[ptMapCurrent]:= UserPathz[ptMaps] + '/' + s;
-    Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s;
+    if s = '' then
+        begin
+        UserPathz[ptMapCurrent]:= s;
+        Pathz[ptMapCurrent]:= s;
+        end
+    else
+        begin
+        UserPathz[ptMapCurrent]:= UserPathz[ptMaps] + '/' + s;
+        Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s;
+        end;
     InitStepsFlags:= InitStepsFlags or cifMap
     end;
 
--- a/hedgewars/uScript.pas	Sat Nov 12 21:59:10 2011 +0100
+++ b/hedgewars/uScript.pas	Sat Nov 12 21:44:26 2011 -0500
@@ -1642,8 +1642,7 @@
 cWaterRise       := ScriptGetInteger('WaterRise');
 cHealthDecrease  := ScriptGetInteger('HealthDecrease');
 
-if ScriptGetString('Map') <> '' then
-    ParseCommand('map ' + ScriptGetString('Map'), true);
+ParseCommand('map ' + ScriptGetString('Map'), true);
 if ScriptGetString('Theme') <> '' then
     ParseCommand('theme ' + ScriptGetString('Theme'), true);
 LuaGoals:= ScriptGetString('Goals');