diff --git a/res/core/messages.xml b/res/core/messages.xml
index bb57fd32d..5f319eacf 100644
--- a/res/core/messages.xml
+++ b/res/core/messages.xml
@@ -7087,13 +7087,6 @@
"Der Unterhalt von $building($building) konnte nicht gezahlt werden, das Gebäude war diese Woche nicht funktionstüchtig."
"The upkeep for $building($building) was not paid, the building was not operational this week."
-
-
-
-
- "Der Unterhalt von $building($building) konnte nur verspätet gezahlt werden, das Gebäude war diese Woche nicht funktionstüchtig."
- "The upkeep for $building($building) was paid late, the building was not operational this week."
-
diff --git a/src/bind_process.c b/src/bind_process.c
index e22a65bc9..e8420c654 100755
--- a/src/bind_process.c
+++ b/src/bind_process.c
@@ -274,7 +274,7 @@ void process_maintenance(void) {
}
}
}
- maintain_buildings(r, false);
+ maintain_buildings(r);
}
}
diff --git a/src/economy.c b/src/economy.c
index 594935871..3712c0d13 100644
--- a/src/economy.c
+++ b/src/economy.c
@@ -709,13 +709,11 @@ static int forget_cmd(unit * u, order * ord)
return 0;
}
-static int maintain(building * b, bool first)
-/* first==false -> take money from wherever you can */
+static int maintain(building * b)
{
- const resource_type *rsilver = get_resourcetype(R_SILVER);
int c;
region *r = b->region;
- bool paid = true, work = first;
+ bool paid = true, work = true;
unit *u;
if (fval(b, BLD_MAINTAINED) || b->type == NULL || b->type->maintenance == NULL) {
@@ -746,25 +744,7 @@ static int maintain(building * b, bool first)
/* first ist im ersten versuch true, im zweiten aber false! Das
* bedeutet, das in der Runde in die Region geschafften Resourcen
* nicht genutzt werden können, weil die reserviert sind! */
- if (!first)
- need -= get_pooled(u, m->rtype, GET_ALL, need);
- else
- need -= get_pooled(u, m->rtype, GET_DEFAULT, need);
- if (!first && need > 0) {
- unit *ua;
- for (ua = r->units; ua; ua = ua->next)
- freset(ua->faction, FFL_SELECT);
- fset(u->faction, FFL_SELECT); /* hat schon */
- for (ua = r->units; ua; ua = ua->next) {
- if (!fval(ua->faction, FFL_SELECT) && (ua->faction == u->faction
- || alliedunit(ua, u->faction, HELP_MONEY))) {
- need -= get_pooled(ua, m->rtype, GET_ALL, need);
- fset(ua->faction, FFL_SELECT);
- if (need <= 0)
- break;
- }
- }
- }
+ need -= get_pooled(u, m->rtype, GET_DEFAULT, need);
}
if (need > 0) {
if (!fval(m, MTF_VITAL))
@@ -789,32 +769,10 @@ static int maintain(building * b, bool first)
if (fval(m, MTF_VARIABLE))
need = need * b->size;
if (u) {
- /* first ist im ersten versuch true, im zweiten aber false! Das
- * bedeutet, das in der Runde in die Region geschafften Resourcen
- * nicht genutzt werden können, weil die reserviert sind! */
- if (!first)
- need -= get_pooled(u, m->rtype, GET_ALL, need);
- else
- need -= get_pooled(u, m->rtype, GET_DEFAULT, need);
- if (!first && need > 0) {
- unit *ua;
- for (ua = r->units; ua; ua = ua->next)
- freset(ua->faction, FFL_SELECT);
- fset(u->faction, FFL_SELECT); /* hat schon */
- for (ua = r->units; ua; ua = ua->next) {
- if (!fval(ua->faction, FFL_SELECT) && (ua->faction == u->faction
- || alliedunit(ua, u->faction, HELP_MONEY))) {
- need -= get_pooled(ua, m->rtype, GET_ALL, need);
- fset(ua->faction, FFL_SELECT);
- if (need <= 0)
- break;
- }
- }
- }
+ need -= get_pooled(u, m->rtype, GET_DEFAULT, need);
if (need > 0) {
work = false;
- if (fval(m, MTF_VITAL))
- {
+ if (fval(m, MTF_VITAL)) {
paid = false;
break;
}
@@ -822,7 +780,7 @@ static int maintain(building * b, bool first)
}
}
if (paid && c > 0) {
- if (first && !work) {
+ if (!work) {
ADDMSG(&u->faction->msgs, msg_message("maintenancefail", "unit building", u, b));
return 0;
}
@@ -836,39 +794,12 @@ static int maintain(building * b, bool first)
if (fval(m, MTF_VARIABLE))
cost = cost * b->size;
- if (!first)
- cost -= use_pooled(u, m->rtype, GET_ALL, cost);
- else
- cost -=
+ cost -=
use_pooled(u, m->rtype, GET_SLACK | GET_RESERVE | GET_POOLED_SLACK,
cost);
- if (!first && cost > 0) {
- unit *ua;
- for (ua = r->units; ua; ua = ua->next)
- freset(ua->faction, FFL_SELECT);
- fset(u->faction, FFL_SELECT); /* hat schon */
- for (ua = r->units; ua; ua = ua->next) {
- if (!fval(ua->faction, FFL_SELECT)
- && alliedunit(ua, u->faction, HELP_MONEY)) {
- int give = use_pooled(ua, m->rtype, GET_ALL, cost);
- if (!give)
- continue;
- cost -= give;
- fset(ua->faction, FFL_SELECT);
- if (m->rtype == rsilver)
- add_donation(ua->faction, u->faction, give, r);
- if (cost <= 0)
- break;
- }
- }
- }
assert(cost == 0);
}
- if (!first) {
- ADDMSG(&u->faction->msgs, msg_message("maintenance_late", "building", b));
- return (BLD_MAINTAINED);
- }
- else if (work) {
+ if (work) {
ADDMSG(&u->faction->msgs, msg_message("maintenance", "unit building", u, b));
return (BLD_MAINTAINED | BLD_WORKING);
}
@@ -877,7 +808,7 @@ static int maintain(building * b, bool first)
return 0;
}
-void maintain_buildings(region * r, bool crash)
+void maintain_buildings(region * r)
{
const curse_type *nocost_ct = ct_find("nocostbuilding");
building **bp = &r->buildings;
@@ -886,27 +817,24 @@ void maintain_buildings(region * r, bool crash)
int flags = (BLD_MAINTAINED | BLD_WORKING);
if (!curse_active(get_curse(b->attribs, nocost_ct))) {
- flags = maintain(b, !crash);
+ flags = maintain(b);
}
fset(b, flags);
- /* the second time, send a message */
- if (crash) {
- if (!fval(b, BLD_WORKING)) {
- unit *u = building_owner(b);
- const char *msgtype =
- flags ? "maintenance_nowork" : "maintenance_none";
- struct message *msg = msg_message(msgtype, "building", b);
+ if (!fval(b, BLD_WORKING)) {
+ unit *u = building_owner(b);
+ const char *msgtype =
+ flags ? "maintenance_nowork" : "maintenance_none";
+ 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);
+ 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/economy.h b/src/economy.h
index 40e05a8a7..b6c8002c9 100644
--- a/src/economy.h
+++ b/src/economy.h
@@ -54,7 +54,7 @@ extern "C" {
void auto_work(struct region *r);
enum { IC_WORK, IC_ENTERTAIN, IC_TAX, IC_TRADE, IC_TRADETAX, IC_STEAL, IC_MAGIC, IC_LOOT };
- void maintain_buildings(struct region *r, bool crash);
+ void maintain_buildings(struct region *r);
int make_cmd(struct unit *u, struct order *ord);
void split_allocations(struct region *r);
int give_control_cmd(struct unit *u, struct order *ord);
diff --git a/src/laws.c b/src/laws.c
index cec092d4c..3129bd16b 100755
--- a/src/laws.c
+++ b/src/laws.c
@@ -4251,11 +4251,6 @@ bool rule_force_leave(int flags) {
return (rules&flags) == flags;
}
-static void maintain_buildings_1(region * r)
-{
- maintain_buildings(r, false);
-}
-
void init_processor(void)
{
int p;
@@ -4340,10 +4335,9 @@ void init_processor(void)
p += 10;
if (!keyword_disabled(K_PAY)) {
- add_proc_order(p, K_PAY, pay_cmd, 0, "Gebaeudeunterhalt (disable)");
+ add_proc_order(p, K_PAY, pay_cmd, 0, "Gebaeudeunterhalt (BEZAHLE NICHT)");
}
- add_proc_postregion(p, maintain_buildings_1,
- "Gebaeudeunterhalt (1. Versuch)");
+ add_proc_postregion(p, maintain_buildings, "Gebaeudeunterhalt");
p += 10; /* QUIT fuer sich alleine */
add_proc_global(p, quit, "Sterben");