diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index 8846b58f1..bb9d9e9b9 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -2909,9 +2909,9 @@ report_summary(summary * s, summary * o, boolean full) } for (f = factions; f; f = f->next) { - if (f->age <= 1 && turn - f->lastorders <= 1) { - newplayers++; - } else if (f->no != MONSTER_FACTION) { + if (fval(f, FFL_ISNEW)) { + ++newplayers; + } else if (f->no != MONSTER_FACTION) { int nmr = turn-f->lastorders; if (nmr<0 || nmr>NMRTimeout()) { log_error(("faction %s has %d NMRS\n", factionid(f), nmr)); diff --git a/src/common/kernel/faction.h b/src/common/kernel/faction.h index a65d65581..3dccc3ef0 100644 --- a/src/common/kernel/faction.h +++ b/src/common/kernel/faction.h @@ -33,6 +33,7 @@ typedef struct shortpwd { #endif /* faction flags */ +#define FFL_ISNEW (1<<1) #define FFL_RESTART (1<<2) #define FFL_QUIT (1<<3) /* #define FL_DH (1<<18) */ diff --git a/src/common/modules/autoseed.c b/src/common/modules/autoseed.c index 9937047a6..e60d965ea 100644 --- a/src/common/modules/autoseed.c +++ b/src/common/modules/autoseed.c @@ -629,6 +629,7 @@ autoseed(newfaction ** players, int nsize, boolean new_island) u = addplayer(r, addfaction(nextf->email, nextf->password, nextf->race, nextf->lang, nextf->subscription)); f = u->faction; + fset(f, FFL_ISNEW); f->alliance = nextf->allies; log_printf("New faction (%s), %s at %s\n", itoa36(f->no), f->email, regionname(r, NULL)); diff --git a/src/eressea/lua/script.cpp b/src/eressea/lua/script.cpp index cafc87804..139b73a7f 100644 --- a/src/eressea/lua/script.cpp +++ b/src/eressea/lua/script.cpp @@ -200,6 +200,9 @@ is_function(struct lua_State * luaState, const char * fname) return true; } log_warning(("Lua global object %s is not a function, type is %u\n", fname, type(fun))); + if (type(fun)!=LUA_TNIL) { + log_warning(("Lua global object %s is not a function, type is %u\n", fname, type(fun))); + } } #else object g = get_globals(luaState); @@ -208,7 +211,9 @@ is_function(struct lua_State * luaState, const char * fname) if (fun.type()==LUA_TFUNCTION) { return true; } - log_warning(("Lua global object %s is not a function, type is %u\n", fname, fun.type())); + if (fun.type()!=LUA_TNIL) { + log_warning(("Lua global object %s is not a function, type is %u\n", fname, fun.type())); + } } #endif return false; diff --git a/src/eressea/main.c b/src/eressea/main.c index b8c7710fc..331b174ff 100644 --- a/src/eressea/main.c +++ b/src/eressea/main.c @@ -484,19 +484,6 @@ read_args(int argc, char **argv) return 0; } -#ifdef BETA_CODE -extern int xml_writeitems(const char * filename); -extern int xml_writeships(void); -extern int xml_writebuildings(void); -#endif - -typedef struct lostdata { - int x, y; - int prevunit; - int building; - int ship; -} lostdata; - void confirm_newbies(void) { @@ -574,12 +561,6 @@ main(int argc, char *argv[]) kernel_init(); game_init(); -#if defined(BETA_CODE) - /* xml_writeships(); */ - /* xml_writebuildings(); */ - xml_writeitems("items.xml"); - return 0; -#endif sprintf(zText, "%d", turn); i = readgame(zText, false); diff --git a/src/eressea/server.cpp b/src/eressea/server.cpp index d6387e395..8eee66cd4 100644 --- a/src/eressea/server.cpp +++ b/src/eressea/server.cpp @@ -101,6 +101,8 @@ /* stdc++ includes */ #include +#include +#include /* libc includes */ #include @@ -601,20 +603,7 @@ read_args(int argc, char **argv, lua_State * luaState) return 0; } -#ifdef BETA_CODE -extern int xml_writeitems(const char * filename); -extern int xml_writeships(void); -extern int xml_writebuildings(void); -#endif - -typedef struct lostdata { - int x, y; - int prevunit; - int building; - int ship; -} lostdata; - -static void +static int my_lua_error(lua_State * L) { const char* error = lua_tostring(L, -1); @@ -622,6 +611,7 @@ my_lua_error(lua_State * L) log_error(("A LUA error occured: %s\n", error)); lua_pop(L, 1); std::terminate(); + return 1; } int @@ -668,6 +658,7 @@ main(int argc, char *argv[]) else strcpy(buf, luafile); #ifdef LUABIND_NO_EXCEPTIONS luabind::set_error_callback(my_lua_error); + luabind::set_pcall_callback(my_lua_error); #else try { #endif