forked from github/server
reset turn to 0 before and after each test.
save tests that depend on the global turn variable would fail when being run out of order. this cause issue #560
This commit is contained in:
parent
a281ace21b
commit
ab876431de
|
@ -623,12 +623,14 @@ static void write_owner(struct gamedata *data, region_owner * owner)
|
|||
if (owner) {
|
||||
faction *f;
|
||||
WRITE_INT(data->store, owner->since_turn);
|
||||
WRITE_INT(data->store, owner->morale_turn);
|
||||
WRITE_INT(data->store, owner->flags);
|
||||
f = owner->last_owner;
|
||||
write_faction_reference((f && f->_alive) ? f : NULL, data->store);
|
||||
f = owner->owner;
|
||||
write_faction_reference((f && f->_alive) ? f : NULL, data->store);
|
||||
if (owner->since_turn >= 0) {
|
||||
WRITE_INT(data->store, owner->morale_turn);
|
||||
WRITE_INT(data->store, owner->flags);
|
||||
f = owner->last_owner;
|
||||
write_faction_reference((f && f->_alive) ? f : NULL, data->store);
|
||||
f = owner->owner;
|
||||
write_faction_reference((f && f->_alive) ? f : NULL, data->store);
|
||||
}
|
||||
}
|
||||
else {
|
||||
WRITE_INT(data->store, -1);
|
||||
|
|
|
@ -162,7 +162,7 @@ static void test_readwrite_dead_faction_regionowner(CuTest *tc) {
|
|||
config_set("rules.region_owners", "1");
|
||||
f = test_create_faction(0);
|
||||
test_create_unit(f, r = test_create_region(0, 0, 0));
|
||||
region_set_owner(r, f, turn);
|
||||
region_set_owner(r, f, 0);
|
||||
destroyfaction(&factions);
|
||||
CuAssertTrue(tc, !f->_alive);
|
||||
remove_empty_units();
|
||||
|
|
|
@ -161,6 +161,7 @@ void test_log_stderr(int flags) {
|
|||
|
||||
static void test_reset(void) {
|
||||
int i;
|
||||
turn = 0;
|
||||
default_locale = 0;
|
||||
free_gamedata();
|
||||
free_terrains();
|
||||
|
|
Loading…
Reference in New Issue