diff options
author | md5 | 2011-05-04 11:36:35 +0300 |
---|---|---|
committer | md5 | 2011-05-04 11:36:35 +0300 |
commit | 5c3b564e0b8fca3c1c4800aef9363f37805f4788 (patch) | |
tree | e0d4e97e572642a67c32a7ba7dc12d68da88ec2e | |
parent | 7b8f3021ac8f1bbc266f7e00c4a649830316fe24 (diff) | |
download | scummvm-rg350-5c3b564e0b8fca3c1c4800aef9363f37805f4788.tar.gz scummvm-rg350-5c3b564e0b8fca3c1c4800aef9363f37805f4788.tar.bz2 scummvm-rg350-5c3b564e0b8fca3c1c4800aef9363f37805f4788.zip |
TSAGE: Now initializing the save game version properly
-rw-r--r-- | engines/tsage/saveload.cpp | 3 | ||||
-rw-r--r-- | engines/tsage/saveload.h | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/engines/tsage/saveload.cpp b/engines/tsage/saveload.cpp index f495f5a433..1ad7fa5ed0 100644 --- a/engines/tsage/saveload.cpp +++ b/engines/tsage/saveload.cpp @@ -121,6 +121,7 @@ Common::Error Saver::save(int slot, const Common::String &saveName) { // Set up the serialiser Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(_vm->generateSaveName(slot)); Serialiser serialiser(NULL, saveFile); + serialiser.setSaveVersion(TSAGE_SAVEGAME_VERSION); // Write out the savegame header tSageSavegameHeader header; @@ -171,6 +172,8 @@ Common::Error Saver::restore(int slot) { readSavegameHeader(saveFile, header); delete header.thumbnail; + serialiser.setSaveVersion(header.version); + // Load in data for objects that need to come at the start of the savegame for (Common::List<SaveListener *>::iterator i = _listeners.begin(); i != _listeners.end(); ++i) { (*i)->listenerSynchronise(serialiser); diff --git a/engines/tsage/saveload.h b/engines/tsage/saveload.h index b1b98ce640..ec7cc7e496 100644 --- a/engines/tsage/saveload.h +++ b/engines/tsage/saveload.h @@ -68,6 +68,12 @@ class Serialiser : public Common::Serializer { public: Serialiser(Common::SeekableReadStream *in, Common::WriteStream *out) : Common::Serializer(in, out) {} + // HACK: TSAGE saved games contain a single byte for the savegame version, + // thus the normal syncVersion() Serializer member won't work here. In order + // to maintain compatibility with older game saves, this method is provided + // in order to set the savegame version from a byte + void setSaveVersion(byte version) { _version = version; } + void syncPointer(SavedObject **ptr, Common::Serializer::Version minVersion = 0, Common::Serializer::Version maxVersion = kLastVersion); void validate(const Common::String &s, Common::Serializer::Version minVersion = 0, |