equal
deleted
inserted
replaced
2885 lua_getglobal(luaState, Str2PChar(name)); |
2885 lua_getglobal(luaState, Str2PChar(name)); |
2886 ScriptGetString:= lua_tostring(luaState, -1); |
2886 ScriptGetString:= lua_tostring(luaState, -1); |
2887 lua_pop(luaState, 1); |
2887 lua_pop(luaState, 1); |
2888 end; |
2888 end; |
2889 |
2889 |
|
2890 function ScriptGetAnsiString(name : shortstring) : ansistring; |
|
2891 begin |
|
2892 lua_getglobal(luaState, Str2PChar(name)); |
|
2893 ScriptGetAnsiString:= lua_tostringa(luaState, -1); |
|
2894 lua_pop(luaState, 1); |
|
2895 end; |
|
2896 |
2890 procedure ScriptOnPreviewInit; |
2897 procedure ScriptOnPreviewInit; |
2891 begin |
2898 begin |
2892 // not required if there is no script to run |
2899 // not required if there is no script to run |
2893 if not ScriptLoaded then |
2900 if not ScriptLoaded then |
2894 exit; |
2901 exit; |
2980 |
2987 |
2981 if cMapName <> ScriptGetString('Map') then |
2988 if cMapName <> ScriptGetString('Map') then |
2982 ParseCommand('map ' + ScriptGetString('Map'), true, true); |
2989 ParseCommand('map ' + ScriptGetString('Map'), true, true); |
2983 if ScriptGetString('Theme') <> '' then |
2990 if ScriptGetString('Theme') <> '' then |
2984 ParseCommand('theme ' + ScriptGetString('Theme'), true, true); |
2991 ParseCommand('theme ' + ScriptGetString('Theme'), true, true); |
2985 LuaGoals:= ScriptGetString('Goals'); |
2992 LuaGoals:= ScriptGetAnsiString('Goals'); |
2986 |
2993 |
2987 // Support lua changing the ammo layout - assume all hogs have same ammo, note this might leave a few ammo stores lying around. |
2994 // Support lua changing the ammo layout - assume all hogs have same ammo, note this might leave a few ammo stores lying around. |
2988 k:= 0; |
2995 k:= 0; |
2989 if (GameFlags and gfSharedAmmo) <> 0 then |
2996 if (GameFlags and gfSharedAmmo) <> 0 then |
2990 for i:= 0 to Pred(ClansCount) do |
2997 for i:= 0 to Pred(ClansCount) do |