From 7d640460226928c1c870db348bbfb05bb45f797f Mon Sep 17 00:00:00 2001 From: CTD Date: Wed, 30 Jul 2014 16:13:14 +0200 Subject: [PATCH] =?UTF-8?q?Bug=201664:=20Obwohl=20kein=20Holz=20vorhanden?= =?UTF-8?q?=20ist,=20kommt=20die=20Meldung,=20da=C3=9F=20der=20Unterhalt?= =?UTF-8?q?=20f=C3=BCr=20die=20Schmiede=20gezahlt=20wurde?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Es wird im ersten Durchlauf nur noch gezahlt wenn das Gebäude dann auch Arbeiten kann (also alles da ist). Ich habe den 2ten Durchlauf erhalten, auch wenn er in Code nicht mehr genutzt wird. --- src/economy.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/economy.c b/src/economy.c index 2f58fc8e2..e90234ecf 100644 --- a/src/economy.c +++ b/src/economy.c @@ -1059,9 +1059,9 @@ static bool maintain(building * b, bool first) } } if (need > 0) { - if (!fval(m, MTF_VITAL)) - work = false; - else { + work = false; + if (fval(m, MTF_VITAL)) + { paid = false; break; } @@ -1070,16 +1070,21 @@ static bool maintain(building * b, bool first) } if (paid && c > 0) { /* TODO: wieviel von was wurde bezahlt */ - if (first) { - ADDMSG(&u->faction->msgs, msg_message("maintenance", "unit building", u, - b)); - } else { + if (first && work) { + ADDMSG(&u->faction->msgs, msg_message("maintenance", "unit building", u, b)); + fset(b, BLD_WORKING); + fset(b, BLD_MAINTAINED); + } + if (!first) { ADDMSG(&u->faction->msgs, msg_message("maintenance_late", "building", b)); + fset(b, BLD_MAINTAINED); } - fset(b, BLD_MAINTAINED); - if (work) { - fset(b, BLD_WORKING); - } + + if (first && !work) { + ADDMSG(&u->faction->msgs, msg_message("maintenancefail", "unit building", u, b)); + return false; + } + for (c = 0; b->type->maintenance[c].number; ++c) { const maintenance *m = b->type->maintenance + c; int cost = m->number; @@ -1118,8 +1123,7 @@ static bool maintain(building * b, bool first) assert(cost == 0); } } else { - ADDMSG(&u->faction->msgs, - msg_message("maintenancefail", "unit building", u, b)); + ADDMSG(&u->faction->msgs, msg_message("maintenancefail", "unit building", u, b)); return false; } return true;