forked from github/server
Miscellaneous fixes, all related to region_owners having leaked into E2. Still doesn't run a full turn of E2. Needs tests.
Issue: 1720
This commit is contained in:
parent
5415d3bf20
commit
61c1dac6ce
6 changed files with 23 additions and 4 deletions
|
@ -1556,7 +1556,7 @@ display_cmd(unit * u, struct order * ord)
|
|||
cmistake(u, ord, 148, MSG_EVENT);
|
||||
break;
|
||||
}
|
||||
if (b != largestbuilding(r, &cmp_current_owner, false)) {
|
||||
if (b != largestbuilding(r, rule_region_owners()?&cmp_current_owner:&cmp_wage, false)) {
|
||||
cmistake(u, ord, 147, MSG_EVENT);
|
||||
break;
|
||||
}
|
||||
|
@ -1800,7 +1800,8 @@ name_cmd(unit * u, struct order * ord)
|
|||
cmistake(u, ord, 148, MSG_EVENT);
|
||||
break;
|
||||
}
|
||||
if (b != largestbuilding(r, &cmp_current_owner, false)) {
|
||||
|
||||
if (b != largestbuilding(r, rule_region_owners()?&cmp_current_owner:&cmp_wage, false)) {
|
||||
cmistake(u, ord, 147, MSG_EVENT);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2677,6 +2677,8 @@ int
|
|||
cmp_current_owner(const building * b, const building * a)
|
||||
{
|
||||
faction * f = region_get_owner(b->region);
|
||||
|
||||
assert(rule_region_owners());
|
||||
if (f && b->type->taxes) {
|
||||
unit * u = buildingowner(b->region, b);
|
||||
if (!u || u->faction!=f) return -1;
|
||||
|
@ -2696,10 +2698,21 @@ cmp_current_owner(const building * b, const building * a)
|
|||
return -1;
|
||||
}
|
||||
|
||||
int rule_region_owners(void)
|
||||
{
|
||||
static int rule_owners = -1;
|
||||
if (rule_owners<0) {
|
||||
rule_owners = get_param_int(global.parameters, "rules.region_owners", 0);
|
||||
}
|
||||
return rule_owners;
|
||||
}
|
||||
|
||||
int rule_auto_taxation(void)
|
||||
{
|
||||
static int rule_taxation = -1;
|
||||
rule_taxation = get_param_int(global.parameters, "rules.economy.taxation", TAX_ORDER);
|
||||
if (rule_taxation<0) {
|
||||
rule_taxation = get_param_int(global.parameters, "rules.economy.taxation", TAX_ORDER);
|
||||
}
|
||||
return rule_taxation;
|
||||
}
|
||||
|
||||
|
|
|
@ -252,6 +252,7 @@ int cmp_current_owner(const struct building * b, const struct building * bother)
|
|||
#define TAX_ORDER 0x00
|
||||
#define TAX_OWNER 0x01
|
||||
int rule_auto_taxation(void);
|
||||
int rule_region_owners(void);
|
||||
|
||||
extern int count_all(const struct faction * f);
|
||||
extern int count_migrants (const struct faction * f);
|
||||
|
|
|
@ -901,7 +901,7 @@ is_guardian_r(const unit * guard)
|
|||
{
|
||||
if (guard->number == 0) return false;
|
||||
if (besieged(guard)) return false;
|
||||
if (guard->building && fval(guard, UFL_OWNER)) {
|
||||
if (guard->building && rule_region_owners() && fval(guard, UFL_OWNER)) {
|
||||
faction * owner = region_get_owner(guard->region);
|
||||
if (owner==guard->faction) {
|
||||
building * bowner = largestbuilding(guard->region, &cmp_taxes, false);
|
||||
|
|
|
@ -1447,6 +1447,7 @@ r_addmessage(struct region * r, const struct faction * viewer, struct message *
|
|||
struct faction *
|
||||
region_get_owner(const struct region * r)
|
||||
{
|
||||
assert(rule_region_owners());
|
||||
if (r->land && r->land->ownership) {
|
||||
return r->land->ownership->owner;
|
||||
}
|
||||
|
@ -1456,6 +1457,7 @@ region_get_owner(const struct region * r)
|
|||
void
|
||||
region_set_owner(struct region * r, struct faction * owner, int turn)
|
||||
{
|
||||
assert(rule_region_owners());
|
||||
if (r->land) {
|
||||
if (!r->land->ownership) {
|
||||
r->land->ownership = malloc(sizeof(region_owner));
|
||||
|
@ -1478,6 +1480,7 @@ region_set_owner(struct region * r, struct faction * owner, int turn)
|
|||
faction * update_owners(region * r)
|
||||
{
|
||||
faction * f = NULL;
|
||||
assert(rule_region_owners());
|
||||
if (r->land) {
|
||||
building * bowner = largestbuilding(r, &cmp_current_owner, false);
|
||||
building * blargest = largestbuilding(r, &cmp_taxes, false);
|
||||
|
|
|
@ -151,6 +151,7 @@
|
|||
<param name="rules.items.loot_divisor" value="2"/> <!-- damage skims off 1/2 of goods transfers -->
|
||||
<param name="rules.items.give_divisor" value="2"/> <!-- corruption skims off 1/2 of goods transfers -->
|
||||
<param name="rules.move.owner_leave" value="1"/> <!-- owner must leave before moving -->
|
||||
<param name="rules.region_owners" value="1">
|
||||
<param name="rules.cavalry.skill" value="2"/>
|
||||
<param name="rules.cavalry.mode" value="1"/>
|
||||
<param name="rules.magic.multipotion" value="1"/>
|
||||
|
|
Loading…
Reference in a new issue