fixing taxes, too

This commit is contained in:
Enno Rehling 2009-08-24 21:09:11 +00:00
parent 1b6dd9fe5a
commit b067c1d511
1 changed files with 1 additions and 28 deletions

View File

@ -3264,33 +3264,6 @@ 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 || (money == maxmoney && b->size>best->size))) {
maxmoney = money;
best = b;
}
}
}
}
}
return best;
}
static void static void
peasant_taxes(region * r) peasant_taxes(region * r)
{ {
@ -3307,7 +3280,7 @@ peasant_taxes(region * r)
money = rmoney(r); money = rmoney(r);
if (money<=0) return; if (money<=0) return;
b = taxbuilding(r); b = largestbuilding(r, cmp_taxes, false);
if (b==NULL) return; if (b==NULL) return;
u = buildingowner(r, b); u = buildingowner(r, b);