aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/core/project_item.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/core/project_item.cpp')
-rw-r--r--engines/titanic/core/project_item.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp
index b2bd5cd92b..6da891c417 100644
--- a/engines/titanic/core/project_item.cpp
+++ b/engines/titanic/core/project_item.cpp
@@ -190,10 +190,6 @@ void CProjectItem::loadGame(int slotId) {
// Load the savegame header in
TitanicSavegameHeader header;
readSavegameHeader(&file, header);
- if (header._thumbnail) {
- header._thumbnail->free();
- delete header._thumbnail;
- }
g_vm->_events->setTotalPlayTicks(header._totalFrames);
@@ -488,13 +484,9 @@ SaveStateList CProjectItem::getSavegameList(const Common::String &target) {
if (in) {
SimpleFile f;
f.open(in);
- if (!readSavegameHeader(&f, header))
- continue;
-
- saveList.push_back(SaveStateDescriptor(slot, header._saveName));
+ if (readSavegameHeader(&f, header))
+ saveList.push_back(SaveStateDescriptor(slot, header._saveName));
- header._thumbnail->free();
- delete header._thumbnail;
delete in;
}
}
@@ -503,7 +495,7 @@ SaveStateList CProjectItem::getSavegameList(const Common::String &target) {
return saveList;
}
-bool CProjectItem::readSavegameHeader(SimpleFile *file, TitanicSavegameHeader &header) {
+bool CProjectItem::readSavegameHeader(SimpleFile *file, TitanicSavegameHeader &header, bool skipThumbnail) {
char saveIdentBuffer[SAVEGAME_STR_SIZE + 1];
header._thumbnail = nullptr;
header._totalFrames = 0;
@@ -526,8 +518,7 @@ bool CProjectItem::readSavegameHeader(SimpleFile *file, TitanicSavegameHeader &h
while ((ch = (char)file->readByte()) != '\0') header._saveName += ch;
// Get the thumbnail
- header._thumbnail = Graphics::loadThumbnail(*file);
- if (!header._thumbnail)
+ if (!Graphics::loadThumbnail(*file, header._thumbnail, skipThumbnail))
return false;
// Read in save date/time