diff --git a/src/kernel/config.c b/src/kernel/config.c index d78362f3c..ccb6f3463 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -922,8 +922,6 @@ default_wage(const region * r, const faction * f, const race * rc, int in_turn) building *b = largestbuilding(r, &cmp_wage, false); int esize = 0; double wage; - attrib *a; - const struct curse_type *ctype; if (b != NULL) { /* TODO: this reveals imaginary castles */ @@ -963,23 +961,28 @@ default_wage(const region * r, const faction * f, const race * rc, int in_turn) } } - /* Godcurse: Income -10 */ - if (curse_active(get_curse(r->attribs, ct_find("godcursezone")))) { - wage = _max(0, wage - 10); + if (r->attribs) { + attrib *a; + const struct curse_type *ctype; + /* Godcurse: Income -10 */ + ctype = ct_find("godcursezone"); + if (ctype && curse_active(get_curse(r->attribs, ctype))) { + wage = _max(0, wage - 10); + } + + /* Bei einer Dürre verdient man nur noch ein Viertel */ + ctype = ct_find("drought"); + if (ctype) { + curse *c = get_curse(r->attribs, ctype); + if (curse_active(c)) + wage /= curse_geteffect(c); + } + + a = a_find(r->attribs, &at_reduceproduction); + if (a) { + wage = (wage * a->data.sa[0]) / 100; + } } - - /* Bei einer Dürre verdient man nur noch ein Viertel */ - ctype = ct_find("drought"); - if (ctype) { - curse *c = get_curse(r->attribs, ctype); - if (curse_active(c)) - wage /= curse_geteffect(c); - } - - a = a_find(r->attribs, &at_reduceproduction); - if (a) - wage = (wage * a->data.sa[0]) / 100; - return (int)wage; }