diff --git a/core/scripts/init.lua b/core/scripts/init.lua index d60434df2..c05d0b17a 100755 --- a/core/scripts/init.lua +++ b/core/scripts/init.lua @@ -34,7 +34,7 @@ function run_turn() end orderfile = orderfile or config.basepath .. '/orders.' .. turn - print("executing turn " .. get_turn() .. " with " .. orderfile) + print("executing turn " .. get_turn() .. " with " .. orderfile .. " with rules=" .. config.rules) local result = process(orderfile) if result==0 then dbupdate() diff --git a/src/bindings.c b/src/bindings.c index fa7ee8a76..31c5fb7df 100755 --- a/src/bindings.c +++ b/src/bindings.c @@ -1026,31 +1026,40 @@ static int tolua_report_unit(lua_State * L) static void parse_inifile(lua_State * L, dictionary * d, const char *section) { - int i; - size_t len = strlen(section); - for (i = 0; d && i != d->n; ++i) { - const char *key = d->key[i]; - if (strncmp(section, key, len) == 0 && key[len] == ':') { - const char *str_value = d->val[i]; - char *endp; - double num_value = strtod(str_value, &endp); - lua_pushstring(L, key + len + 1); - if (*endp) { - tolua_pushstring(L, str_value); - } else { - tolua_pushnumber(L, num_value); - } - lua_rawset(L, -3); - } - } + int i; + const char *arg; + size_t len = strlen(section); - /* special case */ - lua_pushstring(L, "basepath"); - lua_pushstring(L, basepath()); - lua_rawset(L, -3); - lua_pushstring(L, "reportpath"); - lua_pushstring(L, reportpath()); - lua_rawset(L, -3); + for (i = 0; d && i != d->n; ++i) { + const char *key = d->key[i]; + if (strncmp(section, key, len) == 0 && key[len] == ':') { + const char *str_value = d->val[i]; + char *endp; + double num_value = strtod(str_value, &endp); + lua_pushstring(L, key + len + 1); + if (*endp) { + tolua_pushstring(L, str_value); + } + else { + tolua_pushnumber(L, num_value); + } + lua_rawset(L, -3); + } + } + + /* special case */ + lua_pushstring(L, "basepath"); + lua_pushstring(L, basepath()); + lua_rawset(L, -3); + lua_pushstring(L, "reportpath"); + lua_pushstring(L, reportpath()); + lua_rawset(L, -3); + arg = get_param(global.parameters, "config.rules"); + if (arg) { + lua_pushstring(L, "rules"); + lua_pushstring(L, arg); + lua_rawset(L, -3); + } } int tolua_bindings_open(lua_State * L) diff --git a/src/main.c b/src/main.c index a24800064..1b941b41c 100644 --- a/src/main.c +++ b/src/main.c @@ -121,6 +121,10 @@ static int parse_args(int argc, char **argv, int *exitcode) else { const char *arg; switch (argv[i][1]) { + case 'r': + i = get_arg(argc, argv, 2, i, &arg, 0); + set_param(&global.parameters, "config.rules", arg); + break; case 'c': i = get_arg(argc, argv, 2, i, &confpath, 0); break; @@ -137,10 +141,6 @@ static int parse_args(int argc, char **argv, int *exitcode) case 'q': verbosity = 0; break; - case 'r': - i = get_arg(argc, argv, 2, i, &arg, 0); - turn = atoi(arg); - break; case 'v': i = get_arg(argc, argv, 2, i, &arg, 0); verbosity = arg ? atoi(arg) : 0xff; diff --git a/vs2013-build.bat b/vs2013-build.bat index a031839df..6551f2eee 100644 --- a/vs2013-build.bat +++ b/vs2013-build.bat @@ -7,5 +7,5 @@ SET ERESSEA=%CD% CD %SRCDIR% mkdir build-vs%VSVERSION% cd build-vs%VSVERSION% -"%ProgramFiles(x86)%\CMake\bin\cmake.exe" -G "Visual Studio %VSVERSION%" -DCMAKE_PREFIX_PATH="%ProgramFiles(x86)%/Lua/5.1;%ERESSEA%/dependencies-win32" -DCMAKE_MODULE_PATH="%ERESSEA%/server/cmake/Modules" -DCMAKE_SUPPRESS_REGENERATION=TRUE .. +"%ProgramFiles(x86)%\CMake\bin\cmake.exe" -G "Visual Studio %VSVERSION%" -DCMAKE_PREFIX_PATH="%ProgramFiles(x86)%/Lua/5.1;%ERESSEA%/dependencies-win32" -DCMAKE_MODULE_PATH="%SRCDIR%/cmake/Modules" -DCMAKE_SUPPRESS_REGENERATION=TRUE .. PAUSE