Merge pull request #247 from badgerman/feature/bug-1805-nmr-warnings

Bug 1805: re-enable NMR warnings
This commit is contained in:
Enno Rehling 2015-07-03 16:04:18 +02:00
commit 04d609fb5d
6 changed files with 50 additions and 61 deletions

View File

@ -2212,12 +2212,6 @@
<text locale="de">Schaden</text>
</string>
<!--report newbie info -->
<string name="nr_nmr">
<text locale="de">Deine Partei hat letzte Runde keinen Zug
abgegeben!</text>
</string>
<namespace name="race">
<string name="snowman">
<text locale="de">Schneemann</text>

View File

@ -1660,10 +1660,6 @@
</string>
</namespace>
<string name="nr_nmr">
<text locale="en">No orders were received for your faction!</text>
</string>
<!-- resources -->
<string name="mistletoe">
<text locale="de">Mistelzweig</text>

View File

@ -2051,7 +2051,4 @@
<text locale="fr">côte ouest</text>
</string>
</namespace>
<string name="nr_nmr">
<text locale="fr">Aucun ordre reçu pour votre faction !</text>
</string>
</strings>

View File

@ -7100,9 +7100,16 @@
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - Your faction must be at least $int($turns) weeks old to give something to another faction."</text>
</message>
<message name="turnreminder" section="errors">
<type>
</type>
<message name="nmr_warning" section="errors">
<type/>
<text locale="de">Deine Partei hat letzte Runde keinen Zug
abgegeben!</text>
<text locale="en">No orders were received for your faction!</text>
<text locale="fr">Aucun ordre reçu pour votre faction !</text>
</message>
<message name="nmr_warning_final" section="errors">
<type/>
<text locale="de">"Bitte sende die Befehle nächste Runde ein, wenn du weiterspielen möchtest."</text>
<text locale="en">"Please send in orders for the next turn if you want to continue playing."</text>
</message>

View File

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

View File

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