diff --git a/src/common/gamecode/economy.c b/src/common/gamecode/economy.c index dd3dd941c..8a8c0db91 100644 --- a/src/common/gamecode/economy.c +++ b/src/common/gamecode/economy.c @@ -3210,6 +3210,33 @@ auto_work(region * r) } } +static building * +taxbuilding(const region * r) +{ + building *b, *best = NULL; + double maxmoney = 0; + /* durch die verw. von '>' statt '>=' werden die aelteren burgen + * bevorzugt. */ + + if (r->land && r->land->ownership) { + for (b = rbuildings(r); b; b = b->next) { + if (b->type->taxes && r->land->ownership) { + const attrib * a = a_find(b->attribs, &at_icastle); + if (!a) { + int maxsize = buildingeffsize(b, false); + double money = b->type->taxes(b, maxsize); + if (money>0 && (best==NULL || money > maxmoney)) { + maxmoney = money; + best = b; + } + } + } + } + } + return best; +} + + static void peasant_taxes(region * r) { @@ -3219,14 +3246,14 @@ peasant_taxes(region * r) int money; int maxsize; int morale; - + f = region_get_owner(r); if (f==NULL) return; money = rmoney(r); if (money<=0) return; - b = largestbuilding(r, &is_owner_building, false); + b = taxbuilding(r); if (b==NULL) return; u = buildingowner(r, b);