This commit is contained in:
Enno Rehling 2017-05-22 19:50:18 +02:00
parent abb7c9fb17
commit 17ed46e6a8
1 changed files with 3 additions and 2 deletions

View File

@ -547,6 +547,7 @@ static void test_prepare_lighthouse_owners(CuTest *tc)
const struct terrain_type *t_ocean, *t_plain; const struct terrain_type *t_ocean, *t_plain;
test_setup(); test_setup();
enable_skill(SK_PERCEPTION, false);
config_set("rules.region_owner_pay_building", "lighthouse"); config_set("rules.region_owner_pay_building", "lighthouse");
config_set("rules.region_owners", "1"); config_set("rules.region_owners", "1");
t_ocean = test_create_terrain("ocean", SEA_REGION); t_ocean = test_create_terrain("ocean", SEA_REGION);
@ -555,6 +556,7 @@ static void test_prepare_lighthouse_owners(CuTest *tc)
r1 = test_create_region(0, 0, t_plain); r1 = test_create_region(0, 0, t_plain);
r2 = test_create_region(1, 0, t_ocean); r2 = test_create_region(1, 0, t_ocean);
r3 = test_create_region(2, 0, t_ocean); r3 = test_create_region(2, 0, t_ocean);
r3 = test_create_region(3, 0, t_ocean);
btype = test_create_buildingtype("lighthouse"); btype = test_create_buildingtype("lighthouse");
b = test_create_building(r1, btype); b = test_create_building(r1, btype);
b->flags |= BLD_MAINTAINED; b->flags |= BLD_MAINTAINED;
@ -564,8 +566,7 @@ static void test_prepare_lighthouse_owners(CuTest *tc)
u = test_create_unit(test_create_faction(0), r1); u = test_create_unit(test_create_faction(0), r1);
u->building = b; u->building = b;
region_set_owner(b->region, f, 0); region_set_owner(b->region, f, 0);
set_level(u, SK_PERCEPTION, 3); CuAssertIntEquals(tc, 2, lighthouse_range(b, NULL, NULL));
CuAssertIntEquals(tc, 2, lighthouse_range(b, f, NULL));
prepare_report(&ctx, f); prepare_report(&ctx, f);
CuAssertPtrEquals(tc, r1, ctx.first); CuAssertPtrEquals(tc, r1, ctx.first);
CuAssertPtrEquals(tc, NULL, ctx.last); CuAssertPtrEquals(tc, NULL, ctx.last);