diff options
author | Paul Gilbert | 2007-12-02 08:32:21 +0000 |
---|---|---|
committer | Paul Gilbert | 2007-12-02 08:32:21 +0000 |
commit | 692d64f9342a99e45c3950fc472e1a07df927276 (patch) | |
tree | 6a5351fa6b3b36c4786162fe98b7d32a6b8d290b | |
parent | 28a29061229fe69e58983d9a5cc89c5dca0a2fd1 (diff) | |
download | scummvm-rg350-692d64f9342a99e45c3950fc472e1a07df927276.tar.gz scummvm-rg350-692d64f9342a99e45c3950fc472e1a07df927276.tar.bz2 scummvm-rg350-692d64f9342a99e45c3950fc472e1a07df927276.zip |
Added some more code to the savegame load process to correctly handle previously saved savegames (from version 25)
svn-id: r29693
-rw-r--r-- | engines/lure/lure.cpp | 6 | ||||
-rw-r--r-- | engines/lure/lure.h | 2 | ||||
-rw-r--r-- | engines/lure/luredefs.h | 1 | ||||
-rw-r--r-- | engines/lure/res.cpp | 11 | ||||
-rw-r--r-- | engines/lure/room.cpp | 11 |
5 files changed, 24 insertions, 7 deletions
diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp index ab1c4a18e0..af529622e0 100644 --- a/engines/lure/lure.cpp +++ b/engines/lure/lure.cpp @@ -195,8 +195,8 @@ bool LureEngine::loadGame(uint8 slotNumber) { // Check language version uint8 language = f->readByte(); - uint8 version = f->readByte(); - if ((language != _language) || (version != LURE_DAT_MINOR)) { + _saveVersion = f->readByte(); + if ((language != _language) || (_saveVersion < LURE_MIN_SAVEGAME_MINOR)) { warning("loadGame: Failed to load slot %d - incorrect version", slotNumber); delete f; return false; @@ -229,7 +229,7 @@ Common::String *LureEngine::detectSave(int slotNumber) { // Check language version uint8 language = f->readByte(); uint8 version = f->readByte(); - if ((language == _language) && (version == LURE_DAT_MINOR)) { + if ((language == _language) && (version >= LURE_MIN_SAVEGAME_MINOR)) { // Read in the savegame title char saveName[MAX_DESC_SIZE]; char *p = saveName; diff --git a/engines/lure/lure.h b/engines/lure/lure.h index 7ac0977900..83c594e932 100644 --- a/engines/lure/lure.h +++ b/engines/lure/lure.h @@ -46,6 +46,7 @@ class LureEngine : public Engine { private: uint32 _features; uint8 _game; + uint8 _saveVersion; Common::Language _language; Disk *_disk; Resources *_resources; @@ -76,6 +77,7 @@ public: bool loadGame(uint8 slotNumber); bool saveGame(uint8 slotNumber, Common::String &caption); Common::String *detectSave(int slotNumber); + uint8 saveVersion() { return _saveVersion; } }; } // End of namespace Lure diff --git a/engines/lure/luredefs.h b/engines/lure/luredefs.h index 69f3800769..b6ae2dafa8 100644 --- a/engines/lure/luredefs.h +++ b/engines/lure/luredefs.h @@ -35,6 +35,7 @@ namespace Lure { #define SUPPORT_FILENAME "lure.dat" #define LURE_DAT_MAJOR 1 #define LURE_DAT_MINOR 26 +#define LURE_MIN_SAVEGAME_MINOR 25 #define LURE_DEBUG 1 diff --git a/engines/lure/res.cpp b/engines/lure/res.cpp index 67a71a840f..7a9bc842e9 100644 --- a/engines/lure/res.cpp +++ b/engines/lure/res.cpp @@ -27,6 +27,7 @@ #include "lure/disk.h" #include "lure/scripts.h" #include "lure/screen.h" +#include "lure/lure.h" #include "common/endian.h" #include "common/events.h" @@ -696,8 +697,14 @@ void Resources::saveToStream(Common::WriteStream *stream) { } void Resources::loadFromStream(Common::ReadStream *stream) { - debugC(ERROR_DETAILED, kLureDebugScripts, "Loading resource data"); - _talkingCharacter = stream->readUint16LE(); + uint8 saveVersion = LureEngine::getReference().saveVersion(); + + if (saveVersion >= 26) { + debugC(ERROR_DETAILED, kLureDebugScripts, "Loading resource data"); + _talkingCharacter = stream->readUint16LE(); + } else { + _talkingCharacter = 0; + } debugC(ERROR_DETAILED, kLureDebugScripts, "Loading hotspot data"); _hotspotData.loadFromStream(stream); diff --git a/engines/lure/room.cpp b/engines/lure/room.cpp index 63741c7896..00caddb0f9 100644 --- a/engines/lure/room.cpp +++ b/engines/lure/room.cpp @@ -25,6 +25,7 @@ #include "lure/res.h" #include "lure/screen.h" #include "lure/game.h" +#include "lure/lure.h" #include "lure/events.h" #include "lure/strings.h" #include "lure/scripts.h" @@ -739,10 +740,16 @@ void Room::saveToStream(Common::WriteStream *stream) { } void Room::loadFromStream(Common::ReadStream *stream) { - if (_talkDialog) + uint8 saveVersion = LureEngine::getReference().saveVersion(); + + if (_talkDialog) { delete _talkDialog; + _talkDialog = NULL; + } + + if (saveVersion >= 26) + _talkDialog = TalkDialog::loadFromStream(stream); - _talkDialog = TalkDialog::loadFromStream(stream); uint16 roomNum = stream->readUint16LE(); _roomNumber = 999; // Dummy room number so current room is faded out setRoomNumber(roomNum, false); |