setting the rules directory with -r (overrides config.rules from eressea.ini)

This commit is contained in:
Enno Rehling 2014-07-23 15:44:57 +02:00
parent 30e9565ae6
commit 44327d91f6
4 changed files with 39 additions and 30 deletions

View File

@ -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()

View File

@ -1027,7 +1027,9 @@ static int tolua_report_unit(lua_State * L)
static void parse_inifile(lua_State * L, dictionary * d, const char *section)
{
int i;
const char *arg;
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] == ':') {
@ -1037,7 +1039,8 @@ static void parse_inifile(lua_State * L, dictionary * d, const char *section)
lua_pushstring(L, key + len + 1);
if (*endp) {
tolua_pushstring(L, str_value);
} else {
}
else {
tolua_pushnumber(L, num_value);
}
lua_rawset(L, -3);
@ -1051,6 +1054,12 @@ static void parse_inifile(lua_State * L, dictionary * d, const char *section)
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)

View File

@ -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;

View File

@ -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