newterrain sucks.

This commit is contained in:
Enno Rehling 2017-11-05 19:15:43 +01:00
parent 440679da87
commit 96ff0815c4
2 changed files with 13 additions and 16 deletions

View file

@ -1590,17 +1590,10 @@ static void buy(unit * u, request ** buyorders, struct order *ord)
return;
}
if (u_race(u) == get_race(RC_INSECT)) {
/* entweder man ist insekt, oder... */
if (r->terrain != newterrain(T_SWAMP) && r->terrain != newterrain(T_DESERT)
&& !rbuildings(r)) {
cmistake(u, ord, 119, MSG_COMMERCE);
return;
}
}
else {
/* ...oder in der Region mu<6D> es eine Burg geben. */
building *b = 0;
/* Entweder man ist Insekt in Sumpf/Wueste, oder es muss
* einen Handelsposten in der Region geben: */
if (u_race(u) != get_race(RC_INSECT) || (r->terrain == newterrain(T_SWAMP) || r->terrain == newterrain(T_DESERT))) {
building *b = NULL;
if (r->buildings) {
static int cache;
static const struct building_type *bt_castle;

View file

@ -181,7 +181,9 @@ static void setup_terrains(CuTest *tc) {
test_create_terrain("ocean", SEA_REGION | SWIM_INTO | FLY_INTO);
test_create_terrain("swamp", LAND_REGION | WALK_INTO | FLY_INTO);
test_create_terrain("desert", LAND_REGION | WALK_INTO | FLY_INTO);
test_create_terrain("mountain", LAND_REGION | WALK_INTO | FLY_INTO);
init_terrains();
CuAssertPtrNotNull(tc, newterrain(T_MOUNTAIN));
CuAssertPtrNotNull(tc, newterrain(T_OCEAN));
CuAssertPtrNotNull(tc, newterrain(T_PLAIN));
CuAssertPtrNotNull(tc, newterrain(T_SWAMP));
@ -225,7 +227,7 @@ static void test_trade_insect(CuTest *tc) {
init_resources();
test_create_locale();
setup_terrains(tc);
r = setup_trade_region(tc, test_create_terrain("swamp", LAND_REGION));
r = setup_trade_region(tc, get_terrain("swamp"));
init_terrains();
it_luxury = r_luxury(r);
@ -240,6 +242,8 @@ static void test_trade_insect(CuTest *tc) {
produce(u->region);
CuAssertIntEquals(tc, 1, get_item(u, it_luxury));
CuAssertIntEquals(tc, 5, get_item(u, it_silver));
terraform_region(r, get_terrain("swamp"));
test_cleanup();
}