forked from github/server
region ownership fixes
This commit is contained in:
parent
a2475ebdc0
commit
88d64f13e8
5 changed files with 15 additions and 7 deletions
|
@ -3211,7 +3211,7 @@ peasant_taxes(region * r)
|
||||||
money = rmoney(r);
|
money = rmoney(r);
|
||||||
if (money<=0) return;
|
if (money<=0) return;
|
||||||
|
|
||||||
b = largestbuilding(r, &is_tax_building, false);
|
b = largestbuilding(r, &is_owner_building, false);
|
||||||
if (b==NULL) return;
|
if (b==NULL) return;
|
||||||
|
|
||||||
u = buildingowner(r, b);
|
u = buildingowner(r, b);
|
||||||
|
|
|
@ -1469,7 +1469,7 @@ display_cmd(unit * u, struct order * ord)
|
||||||
cmistake(u, ord, 148, MSG_EVENT);
|
cmistake(u, ord, 148, MSG_EVENT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (b != largestbuilding(r, &is_tax_building, false)) {
|
if (b != largestbuilding(r, &is_owner_building, false)) {
|
||||||
cmistake(u, ord, 147, MSG_EVENT);
|
cmistake(u, ord, 147, MSG_EVENT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1712,7 +1712,7 @@ name_cmd(unit * u, struct order * ord)
|
||||||
cmistake(u, ord, 148, MSG_EVENT);
|
cmistake(u, ord, 148, MSG_EVENT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (b != largestbuilding(r, &is_tax_building, false)) {
|
if (b != largestbuilding(r, &is_owner_building, false)) {
|
||||||
cmistake(u, ord, 147, MSG_EVENT);
|
cmistake(u, ord, 147, MSG_EVENT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2621,6 +2621,16 @@ is_castle(const struct building * b)
|
||||||
return (b->type==bt_castle);
|
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)
|
boolean is_tax_building(const building * b)
|
||||||
{
|
{
|
||||||
if (b->type->taxes) {
|
if (b->type->taxes) {
|
||||||
|
|
|
@ -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);
|
struct building *largestbuilding(const struct region * r, boolean (*eval)(const struct building *), boolean imaginary);
|
||||||
boolean is_castle(const struct building * b);
|
boolean is_castle(const struct building * b);
|
||||||
boolean is_tax_building(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_all(const struct faction * f);
|
||||||
extern int count_migrants (const struct faction * f);
|
extern int count_migrants (const struct faction * f);
|
||||||
extern int count_maxmigrants(const struct faction * f);
|
extern int count_maxmigrants(const struct faction * f);
|
||||||
|
|
|
@ -834,11 +834,8 @@ can_leave(unit * u)
|
||||||
rule_leave = get_param_int(global.parameters, "rules.move.owner_leave", 0);
|
rule_leave = get_param_int(global.parameters, "rules.move.owner_leave", 0);
|
||||||
}
|
}
|
||||||
if (rule_leave && u->building && u==buildingowner(u->region, u->building)) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue