fix intermittent test for dead code path, all new volcanos have reduceproduction attributes

This commit is contained in:
Enno Rehling 2016-08-23 07:44:17 +02:00
parent 61929ab2d2
commit bdc9af9b69
2 changed files with 7 additions and 0 deletions

View File

@ -269,6 +269,7 @@ void volcano_update(void)
rsetterrain(r, T_VOLCANO); rsetterrain(r, T_VOLCANO);
} }
else { else {
// TODO: this code path is inactive. are we only keeping it for old data? fix data instead.
if (rng_int() % 100 < 12) { if (rng_int() % 100 < 12) {
ADDMSG(&r->msgs, msg_message("volcanostopsmoke", "region", r)); ADDMSG(&r->msgs, msg_message("volcanostopsmoke", "region", r));
rsetterrain(r, T_VOLCANO); rsetterrain(r, T_VOLCANO);

View File

@ -4,6 +4,11 @@
#include <kernel/region.h> #include <kernel/region.h>
#include <kernel/terrain.h> #include <kernel/terrain.h>
#include <util/attrib.h>
#include <attributes/reduceproduction.h>
#include <CuTest.h> #include <CuTest.h>
static void test_volcano_update(CuTest *tc) { static void test_volcano_update(CuTest *tc) {
@ -14,6 +19,7 @@ static void test_volcano_update(CuTest *tc) {
t_active = test_create_terrain("activevolcano", LAND_REGION); t_active = test_create_terrain("activevolcano", LAND_REGION);
test_cleanup(); test_cleanup();
r = test_create_region(0, 0, t_active); r = test_create_region(0, 0, t_active);
a_add(&r->attribs, make_reduceproduction(25, 10));
volcano_update(); volcano_update();
CuAssertPtrEquals(tc, (void *)t_volcano, (void *)r->terrain); CuAssertPtrEquals(tc, (void *)t_volcano, (void *)r->terrain);
test_cleanup(); test_cleanup();