# HG changeset patch # User nemo # Date 1308084641 14400 # Node ID f2e31a7f953a8956b0bdc36fadfdf31c2f664c89 # Parent e4f6aa3250eb34478a0a95182db24e549b832f61 check alternate script loading path diff -r e4f6aa3250eb -r f2e31a7f953a hedgewars/uScript.pas --- a/hedgewars/uScript.pas Tue Jun 14 16:44:51 2011 -0400 +++ b/hedgewars/uScript.pas Tue Jun 14 16:50:41 2011 -0400 @@ -72,7 +72,8 @@ uRenderUtils, uTextures, uLandGraphics, - SDLh; + SDLh, + sysutils; var luaState : Plua_State; ScriptAmmoLoadout : shortstring; @@ -1436,8 +1437,11 @@ procedure ScriptLoad(name : shortstring); var ret : LongInt; + s : shortstring; begin -ret:= luaL_loadfile(luaState, Str2PChar(Pathz[ptData] + '/' + name)); +s:= UserPathz[ptData] + '/' + name; +if not FileExists(s) then s:= Pathz[ptData] + '/' + name; +ret:= luaL_loadfile(luaState, Str2PChar(s)); if ret <> 0 then begin LuaError('Lua: Failed to load ' + name + '(error ' + IntToStr(ret) + ')');