diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 7938e13f3..c22bd9a18 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -2056,7 +2056,7 @@ email_cmd(unit * u, struct order * ord) } else { faction * f = u->faction; if (set_email(&f->email, s)!=0) { - log_error(("Invalid email address: %s\n", s)); + log_error(("Invalid email address for faction %s: %s\n", itoa36(f->no), s)); ADDMSG(&f->msgs, msg_message("changemail_invalid", "value", gc_add(strdup(s)))); } else { @@ -2446,7 +2446,7 @@ reshow(unit * u, struct order * ord, const char * s, param_t p) #ifdef HEROES static int -promote_cmd(unit * u, struct order * ord) +promotion_cmd(unit * u, struct order * ord) { int money, people; @@ -2471,7 +2471,7 @@ promote_cmd(unit * u, struct order * ord) use_all(u, i_silver->rtype, people); fset(u, UFL_HERO); ADDMSG(&u->faction->msgs, msg_message("hero_promotion", "unit cost", - u, money)); + u, people)); return 0; } #endif @@ -3830,7 +3830,7 @@ processorders (void) #ifdef HEROES puts(" - Heldenbeförderung"); - parse(K_PROMOTION, promote_cmd, false); + parse(K_PROMOTION, promotion_cmd, false); #endif puts(" - Neue Nummern"); diff --git a/src/common/kernel/faction.c b/src/common/kernel/faction.c index c0ee47259..971411ef8 100644 --- a/src/common/kernel/faction.c +++ b/src/common/kernel/faction.c @@ -99,7 +99,7 @@ addfaction(const char *email, const char * password, assert(frace != new_race[RC_ORC]); if (set_email(&f->email, email)!=0) { - log_error(("Invalid email address: %s\n", email)); + log_error(("Invalid email address for faction %s: %s\n", itoa36(f->no), email)); } if (password) { diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index 533410979..fc0eaeff9 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -1524,7 +1524,7 @@ readfaction(FILE * F) rds(F, &f->banner); rds(F, &email); if (set_email(&f->email, email)!=0) { - log_error(("Invalid email address: %s\n", email)); + log_error(("Invalid email address for faction %s: %s\n", itoa36(f->no), email)); set_email(&f->email, ""); } rds(F, &f->passw); diff --git a/src/common/modules/gmcmd.c b/src/common/modules/gmcmd.c index 7d39d4e05..ac76de2f7 100644 --- a/src/common/modules/gmcmd.c +++ b/src/common/modules/gmcmd.c @@ -630,7 +630,7 @@ gm_addquest(const char * email, const char * name, int radius, unsigned int flag f->override = strdup(itoa36(rand())); f->override = strdup(itoa36(rand())); if (set_email(&f->email, email)!=0) { - log_error(("Invalid email address: %s\n", email)); + log_error(("Invalid email address for faction %s: %s\n", itoa36(f->no), email)); } f->name = strdup("Questenpartei"); f->race = new_race[RC_TEMPLATE]; @@ -733,7 +733,7 @@ gm_addfaction(const char * email, plane * p, region * r) f->banner = strdup("Questenpartei"); f->passw = strdup(itoa36(rand())); if (set_email(&f->email, email)!=0) { - log_error(("Invalid email address: %s\n", email)); + log_error(("Invalid email address for faction %s: %s\n", itoa36(f->no), email)); } f->name = strdup("Questenpartei"); f->race = new_race[RC_TEMPLATE]; diff --git a/src/eressea/main.c b/src/eressea/main.c index e9669c800..9a24f921d 100644 --- a/src/eressea/main.c +++ b/src/eressea/main.c @@ -258,7 +258,7 @@ readshortpwds() if (f!=NULL) { shortpwd * pwd = (shortpwd*)malloc(sizeof(shortpwd)); if (set_email(&pwd->email, email)!=0) { - log_error(("Invalid email address: %s\n", email)); + log_error(("Invalid email address faction %s: %s\n", faction, email)); } pwd->pwd = strdup(passwd); pwd->used = false; diff --git a/src/eressea/server.cpp b/src/eressea/server.cpp index 13775c0e4..67d643900 100644 --- a/src/eressea/server.cpp +++ b/src/eressea/server.cpp @@ -631,6 +631,16 @@ typedef struct lostdata { int ship; } lostdata; +static void +my_lua_error(lua_State * L) +{ + const char* error = lua_tostring(L, -1); + + log_error((error)); + lua_pop(L, 1); + std::terminate(); +} + int main(int argc, char *argv[]) { @@ -669,23 +679,21 @@ main(int argc, char *argv[]) // run the main script if (luafile==NULL) lua_console(luaState); else { + if (script_path) sprintf(buf, "%s/%s", script_path, luafile); + else strcpy(buf, luafile); +#ifdef LUABIND_NO_EXCEPTIONS + luabind::set_error_callback(my_lua_error); +#else try { - if (script_path) { - sprintf(buf, "%s/%s", script_path, luafile); - lua_dofile(luaState, buf); - } - else lua_dofile(luaState, luafile); +#endif + lua_dofile(luaState, buf); +#ifndef LUABIND_NO_EXCEPTIONS } catch (luabind::error& e) { lua_State* L = e.state(); - const char* error = lua_tostring(L, -1); - log_error((error)); - lua_pop(L, 1); - std::terminate(); - // L will now point to the destructed - // lua state and be invalid - /* ... */ + my_lua_error(L); } +#endif } #ifdef CLEANUP_CODE game_done(); diff --git a/src/mapper/map_partei.c b/src/mapper/map_partei.c index 8250ac526..9a7fd75b6 100644 --- a/src/mapper/map_partei.c +++ b/src/mapper/map_partei.c @@ -258,7 +258,7 @@ read_newfactions(const char * filename) if (nf) continue; nf = calloc(sizeof(newfaction), 1); if (set_email(&nf->email, email)!=0) { - log_error(("Invalid email address: %s\n", email)); + log_error(("Invalid email address for faction %s: %s\n", itoa36(nf->no), email)); } nf->password = strdup(password); nf->race = rc_find(race);