diff --git a/res/core/de/strings.xml b/res/core/de/strings.xml index c9a2ae616..0b09a972b 100644 --- a/res/core/de/strings.xml +++ b/res/core/de/strings.xml @@ -4464,10 +4464,6 @@ Heimstein Homestone - - Mauern der Ewigkeit - Eternal Walls - Wasserelementar Water Elemental diff --git a/src/bind_process.c b/src/bind_process.c index 7d0124400..e22a65bc9 100755 --- a/src/bind_process.c +++ b/src/bind_process.c @@ -274,7 +274,7 @@ void process_maintenance(void) { } } } - maintain_buildings(r, 0); + maintain_buildings(r, false); } } diff --git a/src/economy.c b/src/economy.c index 2156744b0..594935871 100644 --- a/src/economy.c +++ b/src/economy.c @@ -709,7 +709,7 @@ static int forget_cmd(unit * u, order * ord) return 0; } -static bool maintain(building * b, bool first) +static int maintain(building * b, bool first) /* first==false -> take money from wherever you can */ { const resource_type *rsilver = get_resourcetype(R_SILVER); @@ -718,24 +718,22 @@ static bool maintain(building * b, bool first) bool paid = true, work = first; unit *u; - if (fval(b, BLD_MAINTAINED) || b->type == NULL || b->type->maintenance == NULL || is_cursed(b->attribs, C_NOCOST, 0)) { - fset(b, BLD_MAINTAINED); - fset(b, BLD_WORKING); - return true; + if (fval(b, BLD_MAINTAINED) || b->type == NULL || b->type->maintenance == NULL) { + return (BLD_MAINTAINED|BLD_WORKING); } if (fval(b, BLD_DONTPAY)) { - return false; + return 0; } u = building_owner(b); if (u == NULL) { /* no owner - send a message to the entire region */ ADDMSG(&r->msgs, msg_message("maintenance_noowner", "building", b)); - return false; + return 0; } /* If the owner is the region owner, check if dontpay flag is set for the building where he is in */ if (config_token("rules.region_owner_pay_building", b->type->_name)) { if (fval(u->building, BLD_DONTPAY)) { - return false; + return 0; } } for (c = 0; b->type->maintenance[c].number; ++c) { @@ -778,11 +776,12 @@ static bool maintain(building * b, bool first) } } if (fval(b, BLD_DONTPAY)) { - return false; + return 0; } u = building_owner(b); - if (u == NULL) - return false; + if (!u) { + return 0; + } for (c = 0; b->type->maintenance[c].number; ++c) { const maintenance *m = b->type->maintenance + c; int need = m->number; @@ -823,20 +822,9 @@ static bool maintain(building * b, bool first) } } if (paid && c > 0) { - /* TODO: wieviel von was wurde bezahlt */ - 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); - } - if (first && !work) { ADDMSG(&u->faction->msgs, msg_message("maintenancefail", "unit building", u, b)); - return false; + return 0; } for (c = 0; b->type->maintenance[c].number; ++c) { @@ -876,27 +864,38 @@ static bool maintain(building * b, bool first) } assert(cost == 0); } + if (!first) { + ADDMSG(&u->faction->msgs, msg_message("maintenance_late", "building", b)); + return (BLD_MAINTAINED); + } + else if (work) { + ADDMSG(&u->faction->msgs, msg_message("maintenance", "unit building", u, b)); + return (BLD_MAINTAINED | BLD_WORKING); + } } - else { - ADDMSG(&u->faction->msgs, msg_message("maintenancefail", "unit building", u, b)); - return false; - } - return true; + ADDMSG(&u->faction->msgs, msg_message("maintenancefail", "unit building", u, b)); + return 0; } void maintain_buildings(region * r, bool crash) { + const curse_type *nocost_ct = ct_find("nocostbuilding"); building **bp = &r->buildings; while (*bp) { building *b = *bp; - bool maintained = maintain(b, !crash); + int flags = (BLD_MAINTAINED | BLD_WORKING); + + if (!curse_active(get_curse(b->attribs, nocost_ct))) { + flags = maintain(b, !crash); + } + fset(b, flags); /* the second time, send a message */ if (crash) { if (!fval(b, BLD_WORKING)) { unit *u = building_owner(b); const char *msgtype = - maintained ? "maintenance_nowork" : "maintenance_none"; + flags ? "maintenance_nowork" : "maintenance_none"; struct message *msg = msg_message(msgtype, "building", b); if (u) { diff --git a/src/economy.h b/src/economy.h index 7e399cc76..40e05a8a7 100644 --- a/src/economy.h +++ b/src/economy.h @@ -57,7 +57,6 @@ extern "C" { void maintain_buildings(struct region *r, bool crash); int make_cmd(struct unit *u, struct order *ord); void split_allocations(struct region *r); - int recruit_archetypes(void); int give_control_cmd(struct unit *u, struct order *ord); void give_control(struct unit * u, struct unit * u2); void tax_cmd(struct unit * u, struct order *ord, struct request ** taxorders); diff --git a/src/kernel/building.c b/src/kernel/building.c index c6d7f7af2..707edd4c0 100644 --- a/src/kernel/building.c +++ b/src/kernel/building.c @@ -23,7 +23,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* kernel includes */ #include "item.h" -#include "curse.h" /* für C_NOCOST */ #include "unit.h" #include "faction.h" #include "race.h" diff --git a/src/kernel/curse.c b/src/kernel/curse.c index 11f389474..612127182 100644 --- a/src/kernel/curse.c +++ b/src/kernel/curse.c @@ -359,6 +359,7 @@ static bool cmp_curse(const attrib * a, const void *data) curse *get_curse(attrib * ap, const curse_type * ctype) { attrib *a = ap; + if (!ctype) return NULL; while (a) { if (a->type->flags & ATF_CURSE) { const attrib_type *at = a->type; @@ -724,7 +725,6 @@ static const char *oldnames[MAXCURSE] = { "oldrace", "fumble", "riotzone", - "nocostbuilding", "godcursezone", "speed", "orcish", diff --git a/src/kernel/curse.h b/src/kernel/curse.h index 3e2cf3095..c78e43405 100644 --- a/src/kernel/curse.h +++ b/src/kernel/curse.h @@ -130,7 +130,6 @@ extern "C" { C_OLDRACE, C_FUMBLE, C_RIOT, /*region in Aufruhr */ - C_NOCOST, C_CURSED_BY_THE_GODS, C_SPEED, /* Beschleunigt */ C_ORC, diff --git a/src/report.c b/src/report.c index 84b1291b2..6436fe990 100644 --- a/src/report.c +++ b/src/report.c @@ -1376,15 +1376,7 @@ static int buildingmaintenance(const building * b, const resource_type * rtype) { const building_type *bt = b->type; int c, cost = 0; - static bool init = false; - static const curse_type *nocost_ct; - if (!init) { - init = true; - nocost_ct = ct_find("nocostbuilding"); - } - if (curse_active(get_curse(b->attribs, nocost_ct))) { - return 0; - } + for (c = 0; bt->maintenance && bt->maintenance[c].number; ++c) { const maintenance *m = bt->maintenance + c; if (m->rtype == rtype) { @@ -1410,6 +1402,7 @@ report_template(const char *filename, report_context * ctx, const char *charset) size_t size; int bytes; bool utf8 = _strcmpl(charset, "utf8") == 0 || _strcmpl(charset, "utf-8") == 0; + const curse_type *nocost_ct = ct_find("nocostbuilding"); if (F == NULL) { perror(filename); @@ -1484,15 +1477,16 @@ report_template(const char *filename, report_context * ctx, const char *charset) WARN_STATIC_BUFFER(); if (u->building && building_owner(u->building) == u) { building *b = u->building; - int cost = buildingmaintenance(b, rsilver); - - if (cost > 0) { - bytes = (int)strlcpy(bufp, ",U", size); - if (wrptr(&bufp, &size, bytes) != 0) - WARN_STATIC_BUFFER(); - bytes = (int)strlcpy(bufp, itoa10(cost), size); - if (wrptr(&bufp, &size, bytes) != 0) - WARN_STATIC_BUFFER(); + if (!curse_active(get_curse(b->attribs, nocost_ct))) { + int cost = buildingmaintenance(b, rsilver); + if (cost > 0) { + bytes = (int)strlcpy(bufp, ",U", size); + if (wrptr(&bufp, &size, bytes) != 0) + WARN_STATIC_BUFFER(); + bytes = (int)strlcpy(bufp, itoa10(cost), size); + if (wrptr(&bufp, &size, bytes) != 0) + WARN_STATIC_BUFFER(); + } } } else if (u->ship) {