Do not default newly created buildings to being maintained and working (do that in the create order instead).

This was mucking up one of the new tests.
This commit is contained in:
Enno Rehling 2014-07-04 16:13:48 -07:00
parent f51e5f91ff
commit e0ee82e977
3 changed files with 7 additions and 6 deletions

View File

@ -769,7 +769,7 @@ build_building(unit * u, const building_type * btype, int id, int want, order *
/* build a new building */ /* build a new building */
b = new_building(btype, r, lang); b = new_building(btype, r, lang);
b->type = btype; b->type = btype;
fset(b, BLD_MAINTAINED); fset(b, BLD_MAINTAINED|BLD_WORKING);
/* Die Einheit befindet sich automatisch im Inneren der neuen Burg. */ /* Die Einheit befindet sich automatisch im Inneren der neuen Burg. */
if (u->number && leave(u, false)) { if (u->number && leave(u, false)) {

View File

@ -486,7 +486,6 @@ building *new_building(const struct building_type * btype, region * r,
init_lighthouse = true; init_lighthouse = true;
} }
b->flags = BLD_WORKING | BLD_MAINTAINED;
b->no = newcontainerid(); b->no = newcontainerid();
bhash(b); bhash(b);

View File

@ -43,6 +43,7 @@ static void test_ship_allowed_with_harbor(CuTest * tc)
ship * sh; ship * sh;
terrain_type * ttype; terrain_type * ttype;
building_type * btype; building_type * btype;
building * b;
test_cleanup(); test_cleanup();
test_create_world(); test_create_world();
@ -53,7 +54,8 @@ static void test_ship_allowed_with_harbor(CuTest * tc)
r = test_create_region(0, 0, ttype); r = test_create_region(0, 0, ttype);
sh = test_create_ship(0, 0); sh = test_create_ship(0, 0);
test_create_building(r, btype); b = test_create_building(r, btype);
b->flags |= BLD_WORKING;
CuAssertIntEquals(tc, SA_HARBOUR, check_ship_allowed(sh, r)); CuAssertIntEquals(tc, SA_HARBOUR, check_ship_allowed(sh, r));
} }
@ -73,9 +75,9 @@ static void test_building_type_exists(CuTest * tc)
b = new_building(btype, r, default_locale); b = new_building(btype, r, default_locale);
CuAssertPtrNotNull(tc, b); CuAssertPtrNotNull(tc, b);
CuAssertTrue(tc, !buildingtype_exists(r, NULL, true)); CuAssertTrue(tc, !buildingtype_exists(r, NULL, false));
CuAssertTrue(tc, buildingtype_exists(r, btype, true)); CuAssertTrue(tc, buildingtype_exists(r, btype, false));
CuAssertTrue(tc, !buildingtype_exists(r, btype2, true)); CuAssertTrue(tc, !buildingtype_exists(r, btype2, false));
} }
CuSuite *get_move_suite(void) CuSuite *get_move_suite(void)