From 9b1fdd7ba57c569890b38ea821b93e7f972b534d Mon Sep 17 00:00:00 2001 From: Matthew Cline Date: Wed, 11 Nov 2009 02:33:21 -0800 Subject: store.cc: Allow unset/unused values to be saved Allow unset/unused values to be saved and restored. --- crawl-ref/source/store.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'crawl-ref/source/store.cc') diff --git a/crawl-ref/source/store.cc b/crawl-ref/source/store.cc index 25c50ed763..ad302640e6 100644 --- a/crawl-ref/source/store.cc +++ b/crawl-ref/source/store.cc @@ -413,7 +413,8 @@ store_val_type CrawlStoreValue::get_type() const // Read/write from/to savefile void CrawlStoreValue::write(writer &th) const { - ASSERT(!(flags & SFLAG_UNSET)); + ASSERT(type != SV_NONE || (flags & SFLAG_UNSET)); + ASSERT(!(flags & SFLAG_UNSET) || (type == SV_NONE)); marshallByte(th, (char) type); marshallByte(th, (char) flags); @@ -490,7 +491,7 @@ void CrawlStoreValue::write(writer &th) const } case SV_NONE: - ASSERT(false); + break; case NUM_STORE_VAL_TYPES: ASSERT(false); @@ -502,7 +503,8 @@ void CrawlStoreValue::read(reader &th) type = static_cast(unmarshallByte(th)); flags = (store_flags) unmarshallByte(th); - ASSERT(!(flags & SFLAG_UNSET)); + ASSERT(type != SV_NONE || (flags & SFLAG_UNSET)); + ASSERT(!(flags & SFLAG_UNSET) || (type == SV_NONE)); switch (type) { @@ -588,7 +590,7 @@ void CrawlStoreValue::read(reader &th) } case SV_NONE: - ASSERT(false); + break; case NUM_STORE_VAL_TYPES: ASSERT(false); @@ -1493,9 +1495,7 @@ void CrawlVector::write(writer &th) const for (vec_size i = 0; i < size(); i++) { CrawlStoreValue val = vector[i]; - ASSERT(val.type != SV_NONE); - ASSERT(!(val.flags & SFLAG_UNSET)); - val.write(th); + val.write(th); } assert_validity(); -- cgit v1.2.3-54-g00ecf