hedgewars/uFLGameConfig.pas
branchqmlfrontend
changeset 10612 eb3c1a289a23
parent 10456 6fd99bb73524
child 10819 57e21f7621b0
--- a/hedgewars/uFLGameConfig.pas	Wed Dec 03 23:36:18 2014 +0300
+++ b/hedgewars/uFLGameConfig.pas	Thu Dec 04 00:34:40 2014 +0300
@@ -12,6 +12,7 @@
 procedure setSeed(seed: PChar); cdecl;
 function  getSeed: PChar; cdecl;
 procedure setTheme(themeName: PChar); cdecl;
+procedure setScript(scriptName: PChar); cdecl;
 
 procedure tryAddTeam(teamName: PChar); cdecl;
 procedure tryRemoveTeam(teamName: PChar); cdecl;
@@ -52,13 +53,18 @@
 begin
     case gameType of
     gtPreview: begin
+            if script <> '' then
+                ipcToEngine('escript ' + script);
             ipcToEngine('eseed ' + seed);
             ipcToEngine('e$mapgen ' + intToStr(mapgen));
         end;
     gtLocal: begin
+            if script <> '' then
+                ipcToEngine('escript ' + script);
             ipcToEngine('eseed ' + seed);
             ipcToEngine('e$mapgen ' + intToStr(mapgen));
             ipcToEngine('e$theme ' + theme);
+
             i:= 0;
             while (i < 8) and (teams[i].hogsNumber > 0) do
                 begin
@@ -309,4 +315,12 @@
     currentConfig.theme:= themeName
 end;
 
+procedure setScript(scriptName: PChar); cdecl;
+begin
+    if scriptName <> 'Normal' then
+        currentConfig.script:= '/Scripts/Multiplayer/' + scriptName + '.lua'
+    else
+        currentConfig.script:= ''
+end;
+
 end.