diff options
author | Matthew Cline <zelgadis@sourceforge.net> | 2009-11-11 02:33:21 -0800 |
---|---|---|
committer | Matthew Cline <zelgadis@sourceforge.net> | 2009-11-11 02:33:21 -0800 |
commit | 9b1fdd7ba57c569890b38ea821b93e7f972b534d (patch) | |
tree | c5b8916c4dd0b851a965667a5a8226d974f1a828 /crawl-ref/source/store.cc | |
parent | 0691b2a7f8a8f280456891cbfa440c4eb0711dbd (diff) | |
download | crawl-ref-9b1fdd7ba57c569890b38ea821b93e7f972b534d.tar.gz crawl-ref-9b1fdd7ba57c569890b38ea821b93e7f972b534d.zip |
store.cc: Allow unset/unused values to be saved
Allow unset/unused values to be saved and restored.
Diffstat (limited to 'crawl-ref/source/store.cc')
-rw-r--r-- | crawl-ref/source/store.cc | 14 |
1 files changed, 7 insertions, 7 deletions
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<store_val_type>(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(); |