forked from github/server
remove any reference to old two-stage maintenance.
getting rid of a lot of dead code.
This commit is contained in:
parent
901cf97cb2
commit
43090e1492
|
@ -7087,13 +7087,6 @@
|
|||
<text locale="de">"Der Unterhalt von $building($building) konnte nicht gezahlt werden, das Gebäude war diese Woche nicht funktionstüchtig."</text>
|
||||
<text locale="en">"The upkeep for $building($building) was not paid, the building was not operational this week."</text>
|
||||
</message>
|
||||
<message name="maintenance_late" section="errors">
|
||||
<type>
|
||||
<arg name="building" type="building"/>
|
||||
</type>
|
||||
<text locale="de">"Der Unterhalt von $building($building) konnte nur verspätet gezahlt werden, das Gebäude war diese Woche nicht funktionstüchtig."</text>
|
||||
<text locale="en">"The upkeep for $building($building) was paid late, the building was not operational this week."</text>
|
||||
</message>
|
||||
<message name="income_tradetax" section="economy">
|
||||
<type>
|
||||
<arg name="unit" type="unit"/>
|
||||
|
|
|
@ -274,7 +274,7 @@ void process_maintenance(void) {
|
|||
}
|
||||
}
|
||||
}
|
||||
maintain_buildings(r, false);
|
||||
maintain_buildings(r);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
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 -=
|
||||
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,12 +817,10 @@ 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 =
|
||||
|
@ -907,7 +836,6 @@ void maintain_buildings(region * r, bool crash)
|
|||
}
|
||||
msg_release(msg);
|
||||
}
|
||||
}
|
||||
bp = &b->next;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
10
src/laws.c
10
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");
|
||||
|
|
Loading…
Reference in New Issue