Handwerker (....) bezahlt den Unterhalt von Schmiede (....)

Wenn maintenance fehlschlägt und Gebäude unbrauchbar, eine andere Meldung abgeben als im Fall von nachträglich funktionierender Maintenance.
This commit is contained in:
Enno Rehling 2005-07-10 21:22:54 +00:00
parent a96d3807a6
commit f8da577254
2 changed files with 33 additions and 19 deletions

View File

@ -931,17 +931,15 @@ maintain(building * b, boolean first)
} }
if (paid && c>0) { if (paid && c>0) {
/* TODO: wieviel von was wurde bezahlt */ /* TODO: wieviel von was wurde bezahlt */
message * msg = NULL;
if (first) { if (first) {
msg = add_message(&u->faction->msgs, ADDMSG(&u->faction->msgs, msg_message("maintenance", "unit building", u, b));
msg_message("maintenance", "unit building", u, b));
} else { } else {
msg = add_message(&u->faction->msgs, ADDMSG(&u->faction->msgs, msg_message("maintenance_late", "building", b));
msg_message("maintenance_late", "building", b));
} }
if (msg) msg_release(msg);
fset(b, BLD_MAINTAINED); 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) { for (c=0;b->type->maintenance[c].number;++c) {
const maintenance * m = b->type->maintenance+c; const maintenance * m = b->type->maintenance+c;
int cost = m->number; int cost = m->number;
@ -1035,19 +1033,27 @@ maintain_buildings(boolean crash)
building **bp = &r->buildings; building **bp = &r->buildings;
while (*bp) { while (*bp) {
building * b = *bp; building * b = *bp;
if (!maintain(b, !crash) && crash) { boolean maintained = maintain(b, !crash);
if (rand() % 100 < EINSTURZCHANCE) {
gebaeude_stuerzt_ein(r, b); /* the second time, send a message */
continue; if (crash) {
} else { if (!maintained && (rand() % 100 < EINSTURZCHANCE)) {
unit * u = buildingowner(r, b); gebaeude_stuerzt_ein(r, b);
struct message * msg = msg_message("nomaintenance", "building", b); continue;
if (u) { } 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); add_message(&u->faction->msgs, msg);
r_addmessage(r, u->faction, msg); r_addmessage(r, u->faction, msg);
} } else {
} add_message(&r->msgs, msg);
} }
msg_release(msg);
}
}
bp=&b->next; bp=&b->next;
} }
} }

View File

@ -598,11 +598,19 @@
<text locale="fr">"A message by $unit($unit) from $region($region): '$string'"</text> <text locale="fr">"A message by $unit($unit) from $region($region): '$string'"</text>
<text locale="en">"A message by $unit($unit) from $region($region): '$string'"</text> <text locale="en">"A message by $unit($unit) from $region($region): '$string'"</text>
</message> </message>
<message name="nomaintenance" section="events"> <message name="maintenance_nowork" section="events">
<type>
<arg name="building" type="building"/>
</type>
<text locale="de">"$building($building) hat diese Woche nicht funktioniert, da der Unterhalt nicht rechtzeitig gezahlt wurde."</text>
<text locale="en">"$building($building) did not function this week because upkeep could not be paid."</text>
</message>
<message name="maintenance_none" section="events">
<type> <type>
<arg name="building" type="building"/> <arg name="building" type="building"/>
</type> </type>
<text locale="de">"Für das Gebäude $building($building) konnte die ganze Woche kein Unterhalt bezahlt werden."</text> <text locale="de">"Für das Gebäude $building($building) konnte die ganze Woche kein Unterhalt bezahlt werden."</text>
<text locale="de">"Upkeep for $building($building) could not be paid all week."</text>
</message> </message>
<message name="buildingcrash" section="events"> <message name="buildingcrash" section="events">
<type> <type>