From 8edafa19c5b7a98658f5502c98264ad77c42f483 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 13 Mar 2015 20:39:36 +0100 Subject: [PATCH] fix faction.create locale handling --- scripts/run-tests-e2.lua | 2 +- src/bind_faction.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/run-tests-e2.lua b/scripts/run-tests-e2.lua index aff15eb06..9f08b0f54 100644 --- a/scripts/run-tests-e2.lua +++ b/scripts/run-tests-e2.lua @@ -5,7 +5,7 @@ path = 'scripts' if config.install then path = config.install .. '/' .. path package.path = package.path .. ';' .. config.install .. '/lunit/?.lua' - --needed to find lunit if not run form eressea root. Needs right [lua] install setting in eressea.ini (point to eressea root from the start folder) + --needed to find lunit if not run from eressea root. Needs right [lua] install setting in eressea.ini (point to eressea root from the start folder) end package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua' diff --git a/src/bind_faction.c b/src/bind_faction.c index df89f9d5a..cfe57ebb4 100644 --- a/src/bind_faction.c +++ b/src/bind_faction.c @@ -344,14 +344,14 @@ static int tolua_faction_create(lua_State * L) const char *email = tolua_tostring(L, 1, 0); const char *racename = tolua_tostring(L, 2, 0); const char *lang = tolua_tostring(L, 3, 0); - struct locale *loc = get_locale(lang); + struct locale *loc = lang ? get_locale(lang) : default_locale; faction *f = NULL; - const struct race *frace = rc_find(racename); + const struct race *frace = rc_find(racename ? racename : "human"); if (frace != NULL) { f = addfaction(email, NULL, frace, loc, 0); } if (!f) { - log_error("faction.create(%s, %s, %s)\n", email, racename, lang); + log_error("faction.create(%s, %s, %s)\n", email, frace->_name, locale_name(loc)); } tolua_pushusertype(L, f, TOLUA_CAST "faction"); return 1;