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) {
/* 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;
}
}

View File

@ -598,11 +598,19 @@
<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>
</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>
<arg name="building" type="building"/>
</type>
<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 name="buildingcrash" section="events">
<type>