number of new players in statistics corrected.

This commit is contained in:
Enno Rehling 2006-01-15 11:05:23 +00:00
parent c768096df3
commit 7ad5ed06cb
6 changed files with 16 additions and 37 deletions

View file

@ -2909,8 +2909,8 @@ report_summary(summary * s, summary * o, boolean full)
} }
for (f = factions; f; f = f->next) { for (f = factions; f; f = f->next) {
if (f->age <= 1 && turn - f->lastorders <= 1) { if (fval(f, FFL_ISNEW)) {
newplayers++; ++newplayers;
} else if (f->no != MONSTER_FACTION) { } else if (f->no != MONSTER_FACTION) {
int nmr = turn-f->lastorders; int nmr = turn-f->lastorders;
if (nmr<0 || nmr>NMRTimeout()) { if (nmr<0 || nmr>NMRTimeout()) {

View file

@ -33,6 +33,7 @@ typedef struct shortpwd {
#endif #endif
/* faction flags */ /* faction flags */
#define FFL_ISNEW (1<<1)
#define FFL_RESTART (1<<2) #define FFL_RESTART (1<<2)
#define FFL_QUIT (1<<3) #define FFL_QUIT (1<<3)
/* #define FL_DH (1<<18) */ /* #define FL_DH (1<<18) */

View file

@ -629,6 +629,7 @@ autoseed(newfaction ** players, int nsize, boolean new_island)
u = addplayer(r, addfaction(nextf->email, nextf->password, nextf->race, u = addplayer(r, addfaction(nextf->email, nextf->password, nextf->race,
nextf->lang, nextf->subscription)); nextf->lang, nextf->subscription));
f = u->faction; f = u->faction;
fset(f, FFL_ISNEW);
f->alliance = nextf->allies; f->alliance = nextf->allies;
log_printf("New faction (%s), %s at %s\n", itoa36(f->no), log_printf("New faction (%s), %s at %s\n", itoa36(f->no),
f->email, regionname(r, NULL)); f->email, regionname(r, NULL));

View file

@ -200,6 +200,9 @@ is_function(struct lua_State * luaState, const char * fname)
return true; return true;
} }
log_warning(("Lua global object %s is not a function, type is %u\n", fname, type(fun))); 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 #else
object g = get_globals(luaState); object g = get_globals(luaState);
@ -208,8 +211,10 @@ is_function(struct lua_State * luaState, const char * fname)
if (fun.type()==LUA_TFUNCTION) { if (fun.type()==LUA_TFUNCTION) {
return true; return true;
} }
if (fun.type()!=LUA_TNIL) {
log_warning(("Lua global object %s is not a function, type is %u\n", fname, fun.type())); log_warning(("Lua global object %s is not a function, type is %u\n", fname, fun.type()));
} }
}
#endif #endif
return false; return false;
} }

View file

@ -484,19 +484,6 @@ read_args(int argc, char **argv)
return 0; 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 void
confirm_newbies(void) confirm_newbies(void)
{ {
@ -574,12 +561,6 @@ main(int argc, char *argv[])
kernel_init(); kernel_init();
game_init(); game_init();
#if defined(BETA_CODE)
/* xml_writeships(); */
/* xml_writebuildings(); */
xml_writeitems("items.xml");
return 0;
#endif
sprintf(zText, "%d", turn); sprintf(zText, "%d", turn);
i = readgame(zText, false); i = readgame(zText, false);

View file

@ -101,6 +101,8 @@
/* stdc++ includes */ /* stdc++ includes */
#include <stdexcept> #include <stdexcept>
#include <string>
#include <sstream>
/* libc includes */ /* libc includes */
#include <cstdio> #include <cstdio>
@ -601,20 +603,7 @@ read_args(int argc, char **argv, lua_State * luaState)
return 0; return 0;
} }
#ifdef BETA_CODE static int
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
my_lua_error(lua_State * L) my_lua_error(lua_State * L)
{ {
const char* error = lua_tostring(L, -1); 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)); log_error(("A LUA error occured: %s\n", error));
lua_pop(L, 1); lua_pop(L, 1);
std::terminate(); std::terminate();
return 1;
} }
int int
@ -668,6 +658,7 @@ main(int argc, char *argv[])
else strcpy(buf, luafile); else strcpy(buf, luafile);
#ifdef LUABIND_NO_EXCEPTIONS #ifdef LUABIND_NO_EXCEPTIONS
luabind::set_error_callback(my_lua_error); luabind::set_error_callback(my_lua_error);
luabind::set_pcall_callback(my_lua_error);
#else #else
try { try {
#endif #endif