diff options
-rw-r--r-- | engines/wintermute/base/base_game.cpp | 4 | ||||
-rw-r--r-- | engines/wintermute/base/base_game_settings.cpp | 4 | ||||
-rw-r--r-- | engines/wintermute/base/base_game_settings.h | 3 | ||||
-rw-r--r-- | engines/wintermute/base/base_string_table.cpp | 25 | ||||
-rw-r--r-- | engines/wintermute/base/base_string_table.h | 4 | ||||
-rw-r--r-- | engines/wintermute/dcgf.h | 4 |
6 files changed, 42 insertions, 2 deletions
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index d37a22e2a6..8df39c825a 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -3110,6 +3110,10 @@ bool BaseGame::persist(BasePersistenceManager *persistMgr) { persistMgr->transferUint32(TMEMBER(_autoSaveSlot)); persistMgr->transferBool(TMEMBER(_cursorHidden)); + if (persistMgr->checkVersion(1, 3, 1)) { + _settings->persist(persistMgr); + } + if (!persistMgr->getIsSaving()) { _quitting = false; } diff --git a/engines/wintermute/base/base_game_settings.cpp b/engines/wintermute/base/base_game_settings.cpp index 3b54384cc7..61c5894be3 100644 --- a/engines/wintermute/base/base_game_settings.cpp +++ b/engines/wintermute/base/base_game_settings.cpp @@ -219,4 +219,8 @@ char *BaseGameSettings::getKeyFromStringTable(const char *str) const { return _stringTable->getKey(str); } +bool BaseGameSettings::persist(BasePersistenceManager *persistMgr) { + return _stringTable->persist(persistMgr); +} + } // End of namespace Wintermute diff --git a/engines/wintermute/base/base_game_settings.h b/engines/wintermute/base/base_game_settings.h index fe0e9907e6..2059cb075e 100644 --- a/engines/wintermute/base/base_game_settings.h +++ b/engines/wintermute/base/base_game_settings.h @@ -34,6 +34,7 @@ namespace Wintermute { class BaseStringTable; class BaseGame; +class BasePersistenceManager; class BaseGameSettings { public: const char *getGameFile() const { return (_gameFile ? _gameFile : "default.game"); } @@ -46,6 +47,8 @@ public: bool loadStringTable(const char *filename, bool clearOld); void expandStringByStringTable(char **str) const; char *getKeyFromStringTable(const char *str) const; + + bool persist(BasePersistenceManager *persistMgr); private: char *_gameFile; int _resWidth; diff --git a/engines/wintermute/base/base_string_table.cpp b/engines/wintermute/base/base_string_table.cpp index 9adbbdf7be..7a2428bd48 100644 --- a/engines/wintermute/base/base_string_table.cpp +++ b/engines/wintermute/base/base_string_table.cpp @@ -189,8 +189,10 @@ bool BaseStringTable::loadFile(const char *filename, bool clearOld) { BaseEngine::LOG(0, "Loading string table..."); if (clearOld) { + _filenames.clear(); _strings.clear(); } + _filenames.push_back(Common::String(filename)); uint32 size; byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename, &size); @@ -253,4 +255,27 @@ bool BaseStringTable::loadFile(const char *filename, bool clearOld) { return STATUS_OK; } +bool BaseStringTable::persist(BasePersistenceManager *persistMgr) { + // Do nothing if the save game is too old. + if (!persistMgr->checkVersion(1, 3, 1)) { + return true; + } + uint32 numFiles = _filenames.size(); + persistMgr->transferUint32("NumFiles", &numFiles); + if (persistMgr->getIsSaving()) { + for (int i = 0; i < numFiles; i++) { + persistMgr->transferString("Filename", &_filenames[i]); + } + } else { + _strings.clear(); + _filenames.clear(); + for (int i = 0; i < numFiles; i++) { + Common::String filename = ""; + persistMgr->transferString("Filename", &filename); + loadFile(filename.c_str(), false); + } + } + return true; +} + } // End of namespace Wintermute diff --git a/engines/wintermute/base/base_string_table.h b/engines/wintermute/base/base_string_table.h index 9e915a1ad9..cdcf11917d 100644 --- a/engines/wintermute/base/base_string_table.h +++ b/engines/wintermute/base/base_string_table.h @@ -35,6 +35,8 @@ namespace Wintermute { +class BasePersistenceManager; + class BaseStringTable : public BaseClass { public: bool loadFile(const char *filename, bool deleteAll = true); @@ -44,8 +46,10 @@ public: BaseStringTable(BaseGame *inGame); virtual ~BaseStringTable(); char *getKey(const char *str) const; + bool persist(BasePersistenceManager *persistMgr); private: Common::HashMap<Common::String, Common::String> _strings; + Common::Array<Common::String> _filenames; typedef Common::HashMap<Common::String, Common::String>::const_iterator StringsIter; }; diff --git a/engines/wintermute/dcgf.h b/engines/wintermute/dcgf.h index 78503b8c3b..c919180e45 100644 --- a/engines/wintermute/dcgf.h +++ b/engines/wintermute/dcgf.h @@ -32,8 +32,8 @@ ////////////////////////////////////////////////////////////////////////// #define DCGF_VER_MAJOR 1 -#define DCGF_VER_MINOR 2 -#define DCGF_VER_BUILD 2 +#define DCGF_VER_MINOR 3 +#define DCGF_VER_BUILD 1 #define DCGF_VER_SUFFIX "ScummVM" #define DCGF_VER_BETA true |