At mikade's request. give scripting access to the map name prior to override.
authornemo
Mon, 26 Mar 2012 20:29:37 -0400
changeset 6828 6a5d33bff0b0
parent 6827 a0e152e68337
child 6829 60b039d88dab
At mikade's request. give scripting access to the map name prior to override.
foo
hedgewars/uCommandHandlers.pas
hedgewars/uScript.pas
hedgewars/uVariables.pas
--- a/hedgewars/uCommandHandlers.pas	Mon Mar 26 23:54:12 2012 +0400
+++ b/hedgewars/uCommandHandlers.pas	Mon Mar 26 20:29:37 2012 -0400
@@ -523,7 +523,7 @@
         end;
     InitStepsFlags:= InitStepsFlags or cifMap
     end;
-
+cMapName:= s;
 ScriptLoad('Maps/' + s + '/map.lua')
 end;
 
--- a/hedgewars/uScript.pas	Mon Mar 26 23:54:12 2012 +0400
+++ b/hedgewars/uScript.pas	Mon Mar 26 20:29:37 2012 -0400
@@ -1735,7 +1735,8 @@
 ScriptSetInteger('SuddenDeathTurns', cSuddenDTurns);
 ScriptSetInteger('WaterRise', cWaterRise);
 ScriptSetInteger('HealthDecrease', cHealthDecrease);
-ScriptSetString('Map', 'CHANGE_ME');
+ScriptSetString('Map', cMapName);
+
 ScriptSetString('Theme', '');
 ScriptSetString('Goals', '');
 
@@ -1762,8 +1763,7 @@
 cWaterRise       := ScriptGetInteger('WaterRise');
 cHealthDecrease  := ScriptGetInteger('HealthDecrease');
 
-if ScriptGetString('Map') <> 'CHANGE_ME' then
-    ParseCommand('map ' + ScriptGetString('Map'), true);
+ParseCommand('map ' + ScriptGetString('Map'), true);
 if ScriptGetString('Theme') <> '' then
     ParseCommand('theme ' + ScriptGetString('Theme'), true);
 LuaGoals:= ScriptGetString('Goals');
--- a/hedgewars/uVariables.pas	Mon Mar 26 23:54:12 2012 +0400
+++ b/hedgewars/uVariables.pas	Mon Mar 26 20:29:37 2012 -0400
@@ -57,6 +57,7 @@
     cStereoMode     : TStereoMode = smNone;
     cOnlyStats      : boolean = False;
 //////////////////////////
+    cMapName        : shortstring = '';
 
     alsoShutdownFrontend: boolean = false;