rename to bt_protection

This commit is contained in:
Enno Rehling 2021-03-13 14:20:37 +01:00
parent c8d8eb85d3
commit 376b1106a6
4 changed files with 14 additions and 14 deletions

View File

@ -1927,7 +1927,7 @@ int skilldiff(troop at, troop dt, int dist)
}
if (b->type->flags & BTF_FORTIFICATION) {
int stage = buildingeffsize(b, false);
int beff = building_protection(b->type, stage);
int beff = bt_protection(b->type, stage);
if (beff > 0) {
skdiff -= beff;
is_protected = 2;

View File

@ -325,19 +325,19 @@ static void test_building_defense_bonus(CuTest * tc)
btype = setup_castle();
btype->maxsize = -1; /* unlimited buildigs get the castle bonus */
CuAssertIntEquals(tc, 0, building_protection(btype, 0));
CuAssertIntEquals(tc, 1, building_protection(btype, 1));
CuAssertIntEquals(tc, 3, building_protection(btype, 2));
CuAssertIntEquals(tc, 5, building_protection(btype, 3));
CuAssertIntEquals(tc, 8, building_protection(btype, 4));
CuAssertIntEquals(tc, 12, building_protection(btype, 5));
CuAssertIntEquals(tc, 12, building_protection(btype, 6));
CuAssertIntEquals(tc, 0, bt_protection(btype, 0));
CuAssertIntEquals(tc, 1, bt_protection(btype, 1));
CuAssertIntEquals(tc, 3, bt_protection(btype, 2));
CuAssertIntEquals(tc, 5, bt_protection(btype, 3));
CuAssertIntEquals(tc, 8, bt_protection(btype, 4));
CuAssertIntEquals(tc, 12, bt_protection(btype, 5));
CuAssertIntEquals(tc, 12, bt_protection(btype, 6));
btype->maxsize = 10; /* limited-size buildings are treated like an E3 watchtower */
CuAssertIntEquals(tc, 0, building_protection(btype, 0));
CuAssertIntEquals(tc, 1, building_protection(btype, 1));
CuAssertIntEquals(tc, 2, building_protection(btype, 2));
CuAssertIntEquals(tc, 2, building_protection(btype, 3));
CuAssertIntEquals(tc, 0, bt_protection(btype, 0));
CuAssertIntEquals(tc, 1, bt_protection(btype, 1));
CuAssertIntEquals(tc, 2, bt_protection(btype, 2));
CuAssertIntEquals(tc, 2, bt_protection(btype, 3));
test_teardown();
}

View File

@ -320,7 +320,7 @@ int cmp_castle_size(const building * b, const building * a)
static const int castle_bonus[6] = { 0, 1, 3, 5, 8, 12 };
static const int watch_bonus[3] = { 0, 1, 2 };
int building_protection(const building_type * btype, int stage)
int bt_protection(const building_type * btype, int stage)
{
assert(btype->flags & BTF_FORTIFICATION);
if (btype->maxsize < 0) {

View File

@ -68,7 +68,7 @@ extern "C" {
extern struct attrib_type at_building_generic_type;
int cmp_castle_size(const struct building *b, const struct building *a);
int building_protection(const struct building_type *btype, int stage);
int bt_protection(const struct building_type *btype, int stage);
building_type *bt_get_or_create(const char *name);
bool bt_changed(int *cache);
const building_type *bt_find(const char *name);