forked from github/server
Feature 1865 leere unterhaltspflichtige Gebäude
Gebäude ohne Besitzer werden automatisch vom Regionsbesitzer übernommen (Die Einheit wird sozusagen der neue Gebäudebesitzer). Betreten dann nur noch wenn Helfe Bewache vom Regionsbesitzer. Wichtig: <param name="rules.region_owners" value="1"/>, ist Voraussetzung, es geht also nicht in E2. Es kann für beliebige Gebäude eingeschaltet werden. Example config : <param name="rules.region_owner_pay_building" value="market harbour lighthouse"/>
This commit is contained in:
parent
46ab9e7bb6
commit
51356b061c
|
@ -1029,6 +1029,14 @@ static bool maintain(building * b, bool first)
|
|||
u = building_owner(b);
|
||||
if (u == NULL)
|
||||
return false;
|
||||
/* If the owner is the region owner, check if biggest castle has the dontpay flag */
|
||||
if (get_param(global.parameters, "rules.region_owner_pay_building")) {
|
||||
if (u == building_owner(largestbuilding(r, &cmp_taxes, false))) {
|
||||
if (fval(u->building, BLD_DONTPAY)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (c = 0; b->type->maintenance[c].number; ++c) {
|
||||
const maintenance *m = b->type->maintenance + c;
|
||||
int need = m->number;
|
||||
|
|
|
@ -654,7 +654,7 @@ void building_set_owner(struct unit * owner)
|
|||
static unit *building_owner_ex(const building * bld, const struct faction * last_owner)
|
||||
{
|
||||
unit *u, *heir = 0;
|
||||
|
||||
const char *btypes;
|
||||
/* Eigentümer tot oder kein Eigentümer vorhanden. Erste lebende Einheit
|
||||
* nehmen. */
|
||||
for (u = bld->region->units; u; u = u->next) {
|
||||
|
@ -670,6 +670,13 @@ static unit *building_owner_ex(const building * bld, const struct faction * last
|
|||
}
|
||||
}
|
||||
}
|
||||
btypes = get_param(global.parameters, "rules.region_owner_pay_building");
|
||||
if (btypes && !heir && (strstr(btypes, bld->type->_name) != NULL)) {
|
||||
u = building_owner(largestbuilding(bld->region, &cmp_taxes, false));
|
||||
if (u) {
|
||||
heir = u;
|
||||
}
|
||||
}
|
||||
return heir;
|
||||
}
|
||||
|
||||
|
|
|
@ -1497,6 +1497,8 @@ static void prepare_reports(void)
|
|||
{
|
||||
region *r;
|
||||
faction *f;
|
||||
building *b;
|
||||
const char *btypes;
|
||||
const struct building_type *bt_lighthouse = bt_find("lighthouse");
|
||||
|
||||
for (f = factions; f; f = f->next) {
|
||||
|
@ -1521,6 +1523,28 @@ static void prepare_reports(void)
|
|||
}
|
||||
}
|
||||
|
||||
/* Region owner get always the Lighthouse report */
|
||||
btypes = get_param(global.parameters, "rules.region_owner_pay_building");
|
||||
if (btypes && strstr(btypes, bt_lighthouse->_name) != NULL) {
|
||||
for (b = rbuildings(r); b; b = b->next) {
|
||||
if (b && b->type == bt_lighthouse) {
|
||||
u = building_owner(largestbuilding(r, &cmp_taxes, false));
|
||||
/* alternativ: u = building_owner(b); if not all region owners should see */
|
||||
if (u) {
|
||||
prepare_lighthouse(b, u->faction);
|
||||
if (u_race(u) != get_race(RC_SPELL) || u->number == RS_FARVISION) {
|
||||
if (fval(u, UFL_DISBELIEVES)) {
|
||||
add_seen(u->faction->seen, r, see_unit, true);
|
||||
}
|
||||
else {
|
||||
add_seen(u->faction->seen, r, see_unit, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (u->building && u->building->type == bt_lighthouse) {
|
||||
/* we are in a lighthouse. add the regions we can see from here! */
|
||||
|
@ -1530,12 +1554,14 @@ static void prepare_reports(void)
|
|||
if (u_race(u) != get_race(RC_SPELL) || u->number == RS_FARVISION) {
|
||||
if (fval(u, UFL_DISBELIEVES)) {
|
||||
add_seen(u->faction->seen, r, see_unit, true);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
add_seen(u->faction->seen, r, see_unit, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (fval(r, RF_TRAVELUNIT)) {
|
||||
for (ru = a_find(r->attribs, &at_travelunit);
|
||||
ru && ru->type == &at_travelunit; ru = ru->next) {
|
||||
|
|
Loading…
Reference in New Issue