forked from github/server
fix faction.create locale handling
This commit is contained in:
parent
654ee9e6bf
commit
8edafa19c5
|
@ -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'
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue