forked from github/server
parent
76a173628a
commit
d38a2d28d3
|
@ -634,7 +634,8 @@ recruit(unit * u, struct order * ord, request ** recruitorders)
|
|||
addlist(recruitorders, o);
|
||||
}
|
||||
|
||||
static void apply_owner_change(region * r, faction * f)
|
||||
static void
|
||||
friendly_takeover(region * r, faction * f)
|
||||
{
|
||||
int morale = region_get_morale(r);
|
||||
region_set_owner(r, f, turn);
|
||||
|
@ -653,7 +654,7 @@ give_control(unit * u, unit * u2)
|
|||
if (f==u->faction) {
|
||||
building * b = largestbuilding(r, &cmp_current_owner, false);
|
||||
if (b==u->building) {
|
||||
apply_owner_change(r, u2->faction);
|
||||
friendly_takeover(r, u2->faction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2688,7 +2688,7 @@ cmp_current_owner(const building * b, const building * a)
|
|||
int oldsize = buildingeffsize(a, false);
|
||||
double oldtaxes = a->type->taxes(a, oldsize);
|
||||
|
||||
if (newtaxes!=oldtaxes) return (int)(newtaxes-oldtaxes);
|
||||
if (newtaxes!=oldtaxes) return (newtaxes>oldtaxes)?1:-1;
|
||||
if (newsize!=oldsize) return newsize-oldsize;
|
||||
return (b->size-a->size);
|
||||
} else {
|
||||
|
|
|
@ -1464,11 +1464,6 @@ region_set_owner(struct region * r, struct faction * owner, int turn)
|
|||
region_set_morale(r, MORALE_DEFAULT, turn);
|
||||
r->land->ownership->owner = NULL;
|
||||
r->land->ownership->flags = 0;
|
||||
} else if (r->land->ownership->owner) {
|
||||
region_set_morale(r, MORALE_TAKEOVER, turn);
|
||||
r->land->ownership->flags |= OWNER_MOURNING;
|
||||
} else {
|
||||
r->land->ownership->flags &= ~OWNER_MOURNING;
|
||||
}
|
||||
r->land->ownership->since_turn = turn;
|
||||
assert(r->land->ownership->owner != owner);
|
||||
|
@ -1492,14 +1487,22 @@ faction * update_owners(region * r)
|
|||
if (u==NULL) {
|
||||
if (f) {
|
||||
region_set_owner(r, NULL, turn);
|
||||
r->land->ownership->flags |= OWNER_MOURNING;
|
||||
f = NULL;
|
||||
}
|
||||
} else if (u->faction!=f) {
|
||||
region_set_owner(r, u->faction, turn);
|
||||
if (f) {
|
||||
region_set_morale(r, MORALE_TAKEOVER, turn);
|
||||
r->land->ownership->flags |= OWNER_MOURNING;
|
||||
} else {
|
||||
r->land->ownership->flags &= ~OWNER_MOURNING;
|
||||
}
|
||||
f = u->faction;
|
||||
}
|
||||
}
|
||||
} else if (r->land->ownership && r->land->ownership->owner) {
|
||||
r->land->ownership->flags |= OWNER_MOURNING;
|
||||
region_set_owner(r, NULL, turn);
|
||||
f = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue