diff --git a/src/common/gamecode/economy.c b/src/common/gamecode/economy.c index 5a882365c..adcad8f3f 100644 --- a/src/common/gamecode/economy.c +++ b/src/common/gamecode/economy.c @@ -3211,7 +3211,7 @@ peasant_taxes(region * r) money = rmoney(r); if (money<=0) return; - b = largestbuilding(r, &is_tax_building, false); + b = largestbuilding(r, &is_owner_building, false); if (b==NULL) return; u = buildingowner(r, b); diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index a828132b3..ad0be7e73 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -1469,7 +1469,7 @@ display_cmd(unit * u, struct order * ord) cmistake(u, ord, 148, MSG_EVENT); break; } - if (b != largestbuilding(r, &is_tax_building, false)) { + if (b != largestbuilding(r, &is_owner_building, false)) { cmistake(u, ord, 147, MSG_EVENT); break; } @@ -1712,7 +1712,7 @@ name_cmd(unit * u, struct order * ord) cmistake(u, ord, 148, MSG_EVENT); break; } - if (b != largestbuilding(r, &is_tax_building, false)) { + if (b != largestbuilding(r, &is_owner_building, false)) { cmistake(u, ord, 147, MSG_EVENT); break; } diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index 5383e9714..e81937be3 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -2621,6 +2621,16 @@ is_castle(const struct building * b) return (b->type==bt_castle); } +boolean is_owner_building(const struct building * b) +{ + region * r = b->region; + if (b->type->taxes && r->land && r->land->ownership) { + unit * u = buildingowner(r, b); + return u && u->faction == r->land->ownership->owner; + } + return false; +} + boolean is_tax_building(const building * b) { if (b->type->taxes) { diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index c489de11c..2372926f9 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -247,6 +247,7 @@ extern char * write_unitname(const struct unit * u, char * buffer, size_t size); struct building *largestbuilding(const struct region * r, boolean (*eval)(const struct building *), boolean imaginary); boolean is_castle(const struct building * b); boolean is_tax_building(const struct building * b); +boolean is_owner_building(const struct building * b); extern int count_all(const struct faction * f); extern int count_migrants (const struct faction * f); extern int count_maxmigrants(const struct faction * f); diff --git a/src/common/kernel/unit.c b/src/common/kernel/unit.c index 2f84019dd..2b7db640a 100644 --- a/src/common/kernel/unit.c +++ b/src/common/kernel/unit.c @@ -834,10 +834,7 @@ can_leave(unit * u) rule_leave = get_param_int(global.parameters, "rules.move.owner_leave", 0); } if (rule_leave && u->building && u==buildingowner(u->region, u->building)) { - building * b = largestbuilding(u->region, &is_tax_building, false); - if (b==u->building) { - return false; - } + return false; } return true; }