forked from github/server
Fix taxes with non-taxing buildings.
This commit is contained in:
parent
d5d7797b78
commit
3a74778bba
1 changed files with 29 additions and 2 deletions
|
@ -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
|
static void
|
||||||
peasant_taxes(region * r)
|
peasant_taxes(region * r)
|
||||||
{
|
{
|
||||||
|
@ -3226,7 +3253,7 @@ peasant_taxes(region * r)
|
||||||
money = rmoney(r);
|
money = rmoney(r);
|
||||||
if (money<=0) return;
|
if (money<=0) return;
|
||||||
|
|
||||||
b = largestbuilding(r, &is_owner_building, false);
|
b = taxbuilding(r);
|
||||||
if (b==NULL) return;
|
if (b==NULL) return;
|
||||||
|
|
||||||
u = buildingowner(r, b);
|
u = buildingowner(r, b);
|
||||||
|
|
Loading…
Reference in a new issue