- Frontend: don't pass /script for missions
authorunc0rr
Thu, 06 Oct 2011 00:11:55 +0400
changeset 6088 47d1b04003d1
parent 6087 6e422ea250a1
child 6089 adc69bbb24e5
- Frontend: don't pass /script for missions - Engine: try to load script for map (not tested)
QTfrontend/ui/widget/gamecfgwidget.cpp
hedgewars/uCommandHandlers.pas
hedgewars/uScript.pas
--- a/QTfrontend/ui/widget/gamecfgwidget.cpp	Wed Oct 05 22:57:42 2011 +0400
+++ b/QTfrontend/ui/widget/gamecfgwidget.cpp	Thu Oct 06 00:11:55 2011 +0400
@@ -233,8 +233,10 @@
     if (currentMap.size() > 0)
     {
         bcfg << QString("emap " + currentMap).toUtf8();
-        if(pMapContainer->getCurrentIsMission())
-            bcfg << QString("escript Maps/%1/map.lua").arg(currentMap).toUtf8();
+
+// engine should figure it out on its own
+//        if(pMapContainer->getCurrentIsMission())
+//            bcfg << QString("escript Maps/%1/map.lua").arg(currentMap).toUtf8();
     }
     bcfg << QString("etheme " + pMapContainer->getCurrentTheme()).toUtf8();
 
--- a/hedgewars/uCommandHandlers.pas	Wed Oct 05 22:57:42 2011 +0400
+++ b/hedgewars/uCommandHandlers.pas	Thu Oct 06 00:11:55 2011 +0400
@@ -451,11 +451,13 @@
 procedure chSetMap(var s: shortstring);
 begin
 if isDeveloperMode then
-begin
-UserPathz[ptMapCurrent]:= UserPathz[ptMaps] + '/' + s;
-Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s;
-InitStepsFlags:= InitStepsFlags or cifMap
-end
+    begin
+    UserPathz[ptMapCurrent]:= UserPathz[ptMaps] + '/' + s;
+    Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s;
+    InitStepsFlags:= InitStepsFlags or cifMap
+    end;
+
+ScriptLoad(s)
 end;
 
 procedure chSetTheme(var s: shortstring);
--- a/hedgewars/uScript.pas	Wed Oct 05 22:57:42 2011 +0400
+++ b/hedgewars/uScript.pas	Thu Oct 06 00:11:55 2011 +0400
@@ -1673,6 +1673,8 @@
 begin
 s:= UserPathz[ptData] + '/' + name;
 if not FileExists(s) then s:= Pathz[ptData] + '/' + name;
+if not FileExists(s) then exit;
+
 ret:= luaL_loadfile(luaState, Str2PChar(s));
 if ret <> 0 then
     begin