diff options
author | Eric Fry | 2018-06-28 23:23:49 +1000 |
---|---|---|
committer | Eugene Sandulenko | 2018-07-20 06:43:33 +0000 |
commit | 02eaa4c83d643d8a14a25d16a9cacbd3bfedf006 (patch) | |
tree | afd6d35c54ccb87937f8bff6d2c2275c260d4ddf /engines/illusions | |
parent | 8e43261d13a81131e0be0bfc75627f7395f78a90 (diff) | |
download | scummvm-rg350-02eaa4c83d643d8a14a25d16a9cacbd3bfedf006.tar.gz scummvm-rg350-02eaa4c83d643d8a14a25d16a9cacbd3bfedf006.tar.bz2 scummvm-rg350-02eaa4c83d643d8a14a25d16a9cacbd3bfedf006.zip |
ILLUSIONS: Refactor savegame thumbnail logic to be inline with rest of tree
Diffstat (limited to 'engines/illusions')
-rw-r--r-- | engines/illusions/detection.cpp | 4 | ||||
-rw-r--r-- | engines/illusions/illusions.h | 2 | ||||
-rw-r--r-- | engines/illusions/saveload.cpp | 10 |
3 files changed, 7 insertions, 9 deletions
diff --git a/engines/illusions/detection.cpp b/engines/illusions/detection.cpp index 89fa429457..cf771f81b8 100644 --- a/engines/illusions/detection.cpp +++ b/engines/illusions/detection.cpp @@ -147,7 +147,7 @@ SaveStateList IllusionsMetaEngine::listSaves(const char *target) const { if (slotNum >= 0 && slotNum <= 999) { Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); if (in) { - if (Illusions::IllusionsEngine::readSaveHeader(in, false, header) == Illusions::IllusionsEngine::kRSHENoError) { + if (Illusions::IllusionsEngine::readSaveHeader(in, header) == Illusions::IllusionsEngine::kRSHENoError) { saveList.push_back(SaveStateDescriptor(slotNum, header.description)); } delete in; @@ -164,7 +164,7 @@ SaveStateDescriptor IllusionsMetaEngine::querySaveMetaInfos(const char *target, if (in) { Illusions::IllusionsEngine::SaveHeader header; Illusions::IllusionsEngine::kReadSaveHeaderError error; - error = Illusions::IllusionsEngine::readSaveHeader(in, true, header); + error = Illusions::IllusionsEngine::readSaveHeader(in, header, false); delete in; if (error == Illusions::IllusionsEngine::kRSHENoError) { SaveStateDescriptor desc(slot, header.description); diff --git a/engines/illusions/illusions.h b/engines/illusions/illusions.h index 9cf1e0b83f..68557926f1 100644 --- a/engines/illusions/illusions.h +++ b/engines/illusions/illusions.h @@ -244,7 +244,7 @@ public: const char *getSavegameFilename(int num); bool existsSavegame(int num); static Common::String getSavegameFilename(const Common::String &target, int num); - static kReadSaveHeaderError readSaveHeader(Common::SeekableReadStream *in, bool loadThumbnail, SaveHeader &header); + static kReadSaveHeaderError readSaveHeader(Common::SeekableReadStream *in, SaveHeader &header, bool skipThumbnail = true); }; diff --git a/engines/illusions/saveload.cpp b/engines/illusions/saveload.cpp index 233771af2a..9409173c42 100644 --- a/engines/illusions/saveload.cpp +++ b/engines/illusions/saveload.cpp @@ -31,7 +31,7 @@ namespace Illusions { #define ILLUSIONS_SAVEGAME_VERSION 0 -IllusionsEngine::kReadSaveHeaderError IllusionsEngine::readSaveHeader(Common::SeekableReadStream *in, bool loadThumbnail, SaveHeader &header) { +IllusionsEngine::kReadSaveHeaderError IllusionsEngine::readSaveHeader(Common::SeekableReadStream *in, SaveHeader &header, bool skipThumbnail) { header.version = in->readUint32LE(); if (header.version > ILLUSIONS_SAVEGAME_VERSION) @@ -43,10 +43,8 @@ IllusionsEngine::kReadSaveHeaderError IllusionsEngine::readSaveHeader(Common::Se header.description += (char)in->readByte(); } - if (loadThumbnail) { - Graphics::loadThumbnail(*in, header.thumbnail); - } else { - Graphics::skipThumbnail(*in); + if (!Graphics::loadThumbnail(*in, header.thumbnail, skipThumbnail)) { + return kRSHEIoError; } // Not used yet, reserved for future usage @@ -110,7 +108,7 @@ bool IllusionsEngine::loadgame(const char *filename) { SaveHeader header; - kReadSaveHeaderError errorCode = readSaveHeader(in, false, header); + kReadSaveHeaderError errorCode = readSaveHeader(in, header); if (errorCode != kRSHENoError) { warning("Error loading savegame '%s'", filename); |