forked from github/server
introduce new building_protection as a shortcut.
This commit is contained in:
parent
376b1106a6
commit
c5b8839634
3 changed files with 9 additions and 5 deletions
|
@ -1926,8 +1926,7 @@ int skilldiff(troop at, troop dt, int dist)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (b->type->flags & BTF_FORTIFICATION) {
|
if (b->type->flags & BTF_FORTIFICATION) {
|
||||||
int stage = buildingeffsize(b, false);
|
int beff = building_protection(b);
|
||||||
int beff = bt_protection(b->type, stage);
|
|
||||||
if (beff > 0) {
|
if (beff > 0) {
|
||||||
skdiff -= beff;
|
skdiff -= beff;
|
||||||
is_protected = 2;
|
is_protected = 2;
|
||||||
|
|
|
@ -335,6 +335,10 @@ int bt_protection(const building_type * btype, int stage)
|
||||||
return watch_bonus[stage];
|
return watch_bonus[stage];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int building_protection(const building* b) {
|
||||||
|
return bt_protection(b->type, buildingeffsize(b, false));
|
||||||
|
}
|
||||||
|
|
||||||
void write_building_reference(const struct building *b, struct storage *store)
|
void write_building_reference(const struct building *b, struct storage *store)
|
||||||
{
|
{
|
||||||
WRITE_INT(store, (b && b->region) ? b->no : 0);
|
WRITE_INT(store, (b && b->region) ? b->no : 0);
|
||||||
|
|
|
@ -115,6 +115,7 @@ extern "C" {
|
||||||
int build_building(struct unit *u, const struct building_type *typ,
|
int build_building(struct unit *u, const struct building_type *typ,
|
||||||
int id, int size, struct order *ord);
|
int id, int size, struct order *ord);
|
||||||
bool building_finished(const struct building *b);
|
bool building_finished(const struct building *b);
|
||||||
|
int building_protection(const struct building *b);
|
||||||
|
|
||||||
int wage(const struct region *r, const struct race *rc);
|
int wage(const struct region *r, const struct race *rc);
|
||||||
int peasant_wage(const struct region *r, bool mourn);
|
int peasant_wage(const struct region *r, bool mourn);
|
||||||
|
|
Loading…
Reference in a new issue