diff --git a/src/kernel/save.c b/src/kernel/save.c index fb0c0eba4..fccd8468e 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -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); diff --git a/src/kernel/save.test.c b/src/kernel/save.test.c index 12ab11cc3..9ab6c4d50 100644 --- a/src/kernel/save.test.c +++ b/src/kernel/save.test.c @@ -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(); diff --git a/src/tests.c b/src/tests.c index b9336bb25..1af387543 100644 --- a/src/tests.c +++ b/src/tests.c @@ -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();