From f8da577254b5f106844d81eae33f6cc554fe52db Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 10 Jul 2005 21:22:54 +0000 Subject: [PATCH] http://eressea.upb.de/mantis/view.php?id=596 Handwerker (....) bezahlt den Unterhalt von Schmiede (....) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wenn maintenance fehlschlägt und Gebäude unbrauchbar, eine andere Meldung abgeben als im Fall von nachträglich funktionierender Maintenance. --- src/common/gamecode/economy.c | 42 ++++++++++++++++++++--------------- src/res/messages.xml | 10 ++++++++- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/src/common/gamecode/economy.c b/src/common/gamecode/economy.c index 818825dec..c88b13e39 100644 --- a/src/common/gamecode/economy.c +++ b/src/common/gamecode/economy.c @@ -931,17 +931,15 @@ maintain(building * b, boolean first) } if (paid && c>0) { /* TODO: wieviel von was wurde bezahlt */ - message * msg = NULL; if (first) { - msg = add_message(&u->faction->msgs, - msg_message("maintenance", "unit building", u, b)); + ADDMSG(&u->faction->msgs, msg_message("maintenance", "unit building", u, b)); } else { - msg = add_message(&u->faction->msgs, - msg_message("maintenance_late", "building", b)); + ADDMSG(&u->faction->msgs, msg_message("maintenance_late", "building", b)); } - if (msg) msg_release(msg); fset(b, BLD_MAINTAINED); - if (work) fset(b, BLD_WORKING); + if (work) { + fset(b, BLD_WORKING); + } for (c=0;b->type->maintenance[c].number;++c) { const maintenance * m = b->type->maintenance+c; int cost = m->number; @@ -1035,19 +1033,27 @@ maintain_buildings(boolean crash) building **bp = &r->buildings; while (*bp) { building * b = *bp; - if (!maintain(b, !crash) && crash) { - if (rand() % 100 < EINSTURZCHANCE) { - gebaeude_stuerzt_ein(r, b); - continue; - } else { - unit * u = buildingowner(r, b); - struct message * msg = msg_message("nomaintenance", "building", b); - if (u) { + boolean maintained = maintain(b, !crash); + + /* the second time, send a message */ + if (crash) { + if (!maintained && (rand() % 100 < EINSTURZCHANCE)) { + gebaeude_stuerzt_ein(r, b); + continue; + } else if (!fval(b, BLD_WORKING)) { + unit * u = buildingowner(r, b); + const char * msgtype = maintained?"maintenance_none":"maintenance_nowork"; + struct message * msg = msg_message(msgtype, "building", b); + + if (u) { add_message(&u->faction->msgs, msg); r_addmessage(r, u->faction, msg); - } - } - } + } else { + add_message(&r->msgs, msg); + } + msg_release(msg); + } + } bp=&b->next; } } diff --git a/src/res/messages.xml b/src/res/messages.xml index 58db7d396..f35a5a286 100644 --- a/src/res/messages.xml +++ b/src/res/messages.xml @@ -598,11 +598,19 @@ "A message by $unit($unit) from $region($region): '$string'" "A message by $unit($unit) from $region($region): '$string'" - + + + + + "$building($building) hat diese Woche nicht funktioniert, da der Unterhalt nicht rechtzeitig gezahlt wurde." + "$building($building) did not function this week because upkeep could not be paid." + + "Für das Gebäude $building($building) konnte die ganze Woche kein Unterhalt bezahlt werden." + "Upkeep for $building($building) could not be paid all week."