From 80ac5399ec6e353b3a55dd383bbfe285408236c0 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 16 Apr 2005 13:03:35 +0000 Subject: [PATCH] Das schreiben der Zusammenfassung ist jetzt ein Skriptbefehl. Neue Parteien werden in das SQL-log aufgenommen. --- src/common/modules/autoseed.c | 8 +++++++- src/eressea/lua/eressea.cpp | 24 ++++++++++++++++++++++++ src/eressea/server.cpp | 7 ------- src/scripts/default.lua | 3 ++- src/scripts/eressea.lua | 3 ++- 5 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/common/modules/autoseed.c b/src/common/modules/autoseed.c index cd22e6a33..ba797f44a 100644 --- a/src/common/modules/autoseed.c +++ b/src/common/modules/autoseed.c @@ -520,6 +520,7 @@ autoseed(newfaction ** players, int nsize) terraform(r, T_VOLCANO); } else if (nsize && (rand() % isize == 0 || rsize==0)) { newfaction ** nfp, * nextf = *players; + faction * f; unit * u; isize += REGIONS_PER_FACTION; @@ -528,7 +529,12 @@ autoseed(newfaction ** players, int nsize) assert(r->land && r->units==0); u = addplayer(r, addfaction(nextf->email, nextf->password, nextf->race, 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 */ nfp = players; diff --git a/src/eressea/lua/eressea.cpp b/src/eressea/lua/eressea.cpp index be1724aca..920373e46 100644 --- a/src/eressea/lua/eressea.cpp +++ b/src/eressea/lua/eressea.cpp @@ -71,6 +71,28 @@ write_reports() 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); static int @@ -184,6 +206,8 @@ bind_eressea(lua_State * L) def("write_game", &write_game), def("write_passwords", &writepasswd), def("write_reports", &write_reports), + def("init_summary", &init_summary), + def("write_summary", &write_summary), def("read_orders", &readorders), def("process_orders", &process_orders), def("add_equipment", &lua_addequipment), diff --git a/src/eressea/server.cpp b/src/eressea/server.cpp index e5715c2b5..d0bd06b44 100644 --- a/src/eressea/server.cpp +++ b/src/eressea/server.cpp @@ -346,7 +346,6 @@ process_orders() #ifdef SHORTPWDS readshortpwds("passwords"); #endif - begin = make_summary(false); printf(" - Korrekturen Runde %d\n", turn); korrektur(); turn++; @@ -361,12 +360,6 @@ process_orders() remove_unequipped_guarded(); korrektur_end(); - end = make_summary(true); - report_summary(end, begin, false); - report_summary(end, begin, true); - free(end); - free(begin); - update_subscriptions(); return 0; } diff --git a/src/scripts/default.lua b/src/scripts/default.lua index 2fd3dfb43..0fb0f8926 100644 --- a/src/scripts/default.lua +++ b/src/scripts/default.lua @@ -24,6 +24,7 @@ function process(orders) print("could not read game") return -1 end + init_summary() -- run the turn: read_orders(orders) @@ -43,8 +44,8 @@ function process(orders) write_passwords() write_reports() - write_emails() + write_summary() file = "" .. get_turn() if write_game(file)~=0 then diff --git a/src/scripts/eressea.lua b/src/scripts/eressea.lua index e06fc13ae..f91265b91 100644 --- a/src/scripts/eressea.lua +++ b/src/scripts/eressea.lua @@ -58,6 +58,7 @@ function process(orders) print("could not read game") return -1 end + init_summary() -- run the turn: read_orders(orders) @@ -80,8 +81,8 @@ function process(orders) write_passwords() write_reports() - write_emails() + write_summary() file = "" .. get_turn() if write_game(file)~=0 then