Das schreiben der Zusammenfassung ist jetzt ein Skriptbefehl.

Neue Parteien werden in das SQL-log aufgenommen.
This commit is contained in:
Enno Rehling 2005-04-16 13:03:35 +00:00
parent 9725e09309
commit 80ac5399ec
5 changed files with 35 additions and 10 deletions

View File

@ -520,6 +520,7 @@ autoseed(newfaction ** players, int nsize)
terraform(r, T_VOLCANO); terraform(r, T_VOLCANO);
} else if (nsize && (rand() % isize == 0 || rsize==0)) { } else if (nsize && (rand() % isize == 0 || rsize==0)) {
newfaction ** nfp, * nextf = *players; newfaction ** nfp, * nextf = *players;
faction * f;
unit * u; unit * u;
isize += REGIONS_PER_FACTION; isize += REGIONS_PER_FACTION;
@ -528,7 +529,12 @@ autoseed(newfaction ** players, int nsize)
assert(r->land && r->units==0); assert(r->land && r->units==0);
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));
u->faction->alliance = nextf->allies; f = u->faction;
f->alliance = nextf->allies;
if (f->subscription) {
sql_print(("UPDATE subscriptions SET status='ACTIVE', faction='%s', lastturn=%d, password='%s', info='%s' WHERE id=%u;\n",
factionid(f), f->lastorders, f->override, info, f->subscription));
}
/* remove duplicate email addresses */ /* remove duplicate email addresses */
nfp = players; nfp = players;

View File

@ -71,6 +71,28 @@ write_reports()
return 0; return 0;
} }
static summary * sum_begin = 0;
static int
init_summary()
{
sum_begin = make_summary(false);
return 0;
}
static int
write_summary()
{
if (sum_begin) {
summary * sum_end = make_summary(true);
report_summary(sum_end, sum_begin, false);
report_summary(sum_end, sum_begin, true);
return 0;
}
return -1;
}
extern int process_orders(void); extern int process_orders(void);
static int static int
@ -184,6 +206,8 @@ bind_eressea(lua_State * L)
def("write_game", &write_game), def("write_game", &write_game),
def("write_passwords", &writepasswd), def("write_passwords", &writepasswd),
def("write_reports", &write_reports), def("write_reports", &write_reports),
def("init_summary", &init_summary),
def("write_summary", &write_summary),
def("read_orders", &readorders), def("read_orders", &readorders),
def("process_orders", &process_orders), def("process_orders", &process_orders),
def("add_equipment", &lua_addequipment), def("add_equipment", &lua_addequipment),

View File

@ -346,7 +346,6 @@ process_orders()
#ifdef SHORTPWDS #ifdef SHORTPWDS
readshortpwds("passwords"); readshortpwds("passwords");
#endif #endif
begin = make_summary(false);
printf(" - Korrekturen Runde %d\n", turn); printf(" - Korrekturen Runde %d\n", turn);
korrektur(); korrektur();
turn++; turn++;
@ -361,12 +360,6 @@ process_orders()
remove_unequipped_guarded(); remove_unequipped_guarded();
korrektur_end(); korrektur_end();
end = make_summary(true);
report_summary(end, begin, false);
report_summary(end, begin, true);
free(end);
free(begin);
update_subscriptions(); update_subscriptions();
return 0; return 0;
} }

View File

@ -24,6 +24,7 @@ function process(orders)
print("could not read game") print("could not read game")
return -1 return -1
end end
init_summary()
-- run the turn: -- run the turn:
read_orders(orders) read_orders(orders)
@ -43,8 +44,8 @@ function process(orders)
write_passwords() write_passwords()
write_reports() write_reports()
write_emails() write_emails()
write_summary()
file = "" .. get_turn() file = "" .. get_turn()
if write_game(file)~=0 then if write_game(file)~=0 then

View File

@ -58,6 +58,7 @@ function process(orders)
print("could not read game") print("could not read game")
return -1 return -1
end end
init_summary()
-- run the turn: -- run the turn:
read_orders(orders) read_orders(orders)
@ -80,8 +81,8 @@ function process(orders)
write_passwords() write_passwords()
write_reports() write_reports()
write_emails() write_emails()
write_summary()
file = "" .. get_turn() file = "" .. get_turn()
if write_game(file)~=0 then if write_game(file)~=0 then