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) {
|
||||
int stage = buildingeffsize(b, false);
|
||||
int beff = bt_protection(b->type, stage);
|
||||
int beff = building_protection(b);
|
||||
if (beff > 0) {
|
||||
skdiff -= beff;
|
||||
is_protected = 2;
|
||||
|
|
|
@ -335,6 +335,10 @@ int bt_protection(const building_type * btype, int 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)
|
||||
{
|
||||
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 id, int size, struct order *ord);
|
||||
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 peasant_wage(const struct region *r, bool mourn);
|
||||
|
|
Loading…
Reference in a new issue