From 5eb4115054b86d3729e609661df42db228267e92 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 3 Mar 2019 09:23:07 +0100 Subject: [PATCH 1/2] new players should have lastorders = 0, get password. --- src/kernel/faction.c | 2 +- src/reports.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/kernel/faction.c b/src/kernel/faction.c index b595bd902..fc1de186a 100755 --- a/src/kernel/faction.c +++ b/src/kernel/faction.c @@ -299,7 +299,7 @@ unit *addplayer(region * r, faction * f) } while (rc == NULL || urc == RC_DAEMON || !playerrace(rc)); u->irace = rc; } - + f->lastorders = 0; return u; } diff --git a/src/reports.c b/src/reports.c index 6827e7897..056ee8dd0 100644 --- a/src/reports.c +++ b/src/reports.c @@ -1603,7 +1603,9 @@ int write_reports(faction * f) if (noreports) { return false; } - if (f->lastorders == 0) { + if (f->lastorders == 0 || f->age <= 1) { + /* neue Parteien, oder solche die noch NIE einen Zug gemacht haben, + * kriegen ein neues Passwort: */ password = faction_genpassword(f, buffer); } prepare_report(&ctx, f, password); From 3fb9b0db13580c9676f877c853d6553a592a946e Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 3 Mar 2019 09:37:00 +0100 Subject: [PATCH 2/2] fix the new password test --- src/reports.test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/reports.test.c b/src/reports.test.c index aeeb0ff58..7bea6c73c 100644 --- a/src/reports.test.c +++ b/src/reports.test.c @@ -963,6 +963,7 @@ static void test_reports_genpassword(CuTest *tc) { CuAssertTrue(tc, f->password_id != 0); test_clear_messagelist(&f->msgs); f->lastorders = 1; + f->age = 2; pwid = f->password_id; write_reports(f); CuAssertIntEquals(tc, pwid, f->password_id);