From 979f3460d64c833cf4f6a23b4de8be96af5394e1 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 3 Jul 2015 15:31:57 +0200 Subject: [PATCH] Bug 1805: re-enable NMR warnings https://bugs.eressea.de/view.php?id=1805 move warnings to the top of the list of errors in the NR --- res/core/de/strings.xml | 6 ----- res/core/en/strings.xml | 4 ---- res/core/fr/strings.xml | 3 --- res/core/messages.xml | 13 ++++++++--- src/laws.c | 51 ++++++++++++++++++++++++++++++++--------- src/reports.c | 34 --------------------------- 6 files changed, 50 insertions(+), 61 deletions(-) diff --git a/res/core/de/strings.xml b/res/core/de/strings.xml index 351a7e376..aa5b94309 100644 --- a/res/core/de/strings.xml +++ b/res/core/de/strings.xml @@ -2212,12 +2212,6 @@ Schaden - - - Deine Partei hat letzte Runde keinen Zug - abgegeben! - - Schneemann diff --git a/res/core/en/strings.xml b/res/core/en/strings.xml index e68915f06..d80c742b9 100644 --- a/res/core/en/strings.xml +++ b/res/core/en/strings.xml @@ -1660,10 +1660,6 @@ - - No orders were received for your faction! - - Mistelzweig diff --git a/res/core/fr/strings.xml b/res/core/fr/strings.xml index 0fe39c99b..8acc1d89f 100644 --- a/res/core/fr/strings.xml +++ b/res/core/fr/strings.xml @@ -2051,7 +2051,4 @@ côte ouest - - Aucun ordre reçu pour votre faction ! - diff --git a/res/core/messages.xml b/res/core/messages.xml index 0afc458c2..6e6b0c8aa 100644 --- a/res/core/messages.xml +++ b/res/core/messages.xml @@ -7100,9 +7100,16 @@ "$unit($unit) in $region($region): '$order($command)' - Your faction must be at least $int($turns) weeks old to give something to another faction." - - - + + + Deine Partei hat letzte Runde keinen Zug + abgegeben! + No orders were received for your faction! + Aucun ordre reçu pour votre faction ! + + + + "Bitte sende die Befehle nächste Runde ein, wenn du weiterspielen möchtest." "Please send in orders for the next turn if you want to continue playing." diff --git a/src/laws.c b/src/laws.c index 2854b2cc8..e5d9392f3 100755 --- a/src/laws.c +++ b/src/laws.c @@ -125,16 +125,6 @@ static int RemoveNMRNewbie(void) return value; } -static void checkorders(void) -{ - faction *f; - - log_info(" - Warne spaete Spieler..."); - for (f = factions; f; f = f->next) - if (!is_monsters(f) && turn - f->lastorders == NMRTimeout() - 1) - ADDMSG(&f->msgs, msg_message("turnreminder", "")); -} - static void age_unit(region * r, unit * u) { if (u_race(u) == get_race(RC_SPELL)) { @@ -735,6 +725,45 @@ void immigration(void) } } +static void nmr_warnings(void) +{ + faction *f, *fa; +#define FRIEND (HELP_GUARD|HELP_MONEY) + for (f = factions; f; f = f->next) { + if (!fval(f, FFL_NOIDLEOUT) && turn > f->lastorders) { + ADDMSG(&f->msgs, msg_message("nmr_warning", "")); + if (turn - f->lastorders == NMRTimeout() - 1) { + ADDMSG(&f->msgs, msg_message("nmr_warning_final", "")); + } + if ((turn - f->lastorders) >= 2) { + message *msg = NULL; + for (fa = factions; fa; fa = fa->next) { + int warn = 0; + if (get_param_int(global.parameters, "rules.alliances", 0) != 0) { + if (f->alliance && f->alliance == fa->alliance) { + warn = 1; + } + } + else if (alliedfaction(NULL, f, fa, FRIEND) + && alliedfaction(NULL, fa, f, FRIEND)) { + warn = 1; + } + if (warn) { + if (msg == NULL) { + msg = + msg_message("warn_dropout", "faction turns", f, + turn - f->lastorders); + } + add_message(&fa->msgs, msg); + } + } + if (msg != NULL) + msg_release(msg); + } + } + } +} + void demographics(void) { region *r; @@ -810,7 +839,6 @@ void demographics(void) remove_empty_units(); immigration(); - checkorders(); } /* ------------------------------------------------------------- */ @@ -4367,6 +4395,7 @@ void init_processor(void) } p = 10; + add_proc_global(p, nmr_warnings, "NMR Warnings"); add_proc_global(p, new_units, "Neue Einheiten erschaffen"); p += 10; diff --git a/src/reports.c b/src/reports.c index 51ce2c53b..128815f71 100644 --- a/src/reports.c +++ b/src/reports.c @@ -1834,39 +1834,6 @@ int write_reports(faction * f, time_t ltime) return 0; } -static void nmr_warnings(void) -{ - faction *f, *fa; -#define FRIEND (HELP_GUARD|HELP_MONEY) - for (f = factions; f; f = f->next) { - if (!fval(f, FFL_NOIDLEOUT) && (turn - f->lastorders) >= 2) { - message *msg = NULL; - for (fa = factions; fa; fa = fa->next) { - int warn = 0; - if (get_param_int(global.parameters, "rules.alliances", 0) != 0) { - if (f->alliance && f->alliance == fa->alliance) { - warn = 1; - } - } - else if (alliedfaction(NULL, f, fa, FRIEND) - && alliedfaction(NULL, fa, f, FRIEND)) { - warn = 1; - } - if (warn) { - if (msg == NULL) { - msg = - msg_message("warn_dropout", "faction turns", f, - turn - f->lastorders); - } - add_message(&fa->msgs, msg); - } - } - if (msg != NULL) - msg_release(msg); - } - } -} - static void report_donations(void) { region *r; @@ -1945,7 +1912,6 @@ int reports(void) if (verbosity >= 1) { log_printf(stdout, "Writing reports for turn %d:", turn); } - nmr_warnings(); report_donations(); remove_empty_units();