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,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));

View file

@ -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) */

View file

@ -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));

View file

@ -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;

View file

@ -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);

View file

@ -101,6 +101,8 @@
/* stdc++ includes */
#include <stdexcept>
#include <string>
#include <sstream>
/* libc includes */
#include <cstdio>
@ -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