diff options
-rw-r--r-- | engines/titanic/core/project_item.cpp | 13 | ||||
-rw-r--r-- | engines/titanic/core/project_item.h | 7 | ||||
-rw-r--r-- | engines/titanic/detection.cpp | 11 |
3 files changed, 27 insertions, 4 deletions
diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index b16d076f14..fa902e6ab7 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -42,6 +42,19 @@ static const char *const SAVEGAME_STR = "TNIC"; EMPTY_MESSAGE_MAP(CProjectItem, CFileItem); +/*------------------------------------------------------------------------*/ + +void TitanicSavegameHeader::clear() { + _version = 0; + _saveName = ""; + _thumbnail = nullptr; + _year = _month = _day = 0; + _hour = _minute = 0; + _totalFrames = 0; +} + +/*------------------------------------------------------------------------*/ + void CFileListItem::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); file->writeQuotedLine(_name, indent); diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h index 14ca3fd229..71a84f7e00 100644 --- a/engines/titanic/core/project_item.h +++ b/engines/titanic/core/project_item.h @@ -42,6 +42,13 @@ struct TitanicSavegameHeader { int _year, _month, _day; int _hour, _minute; int _totalFrames; + + TitanicSavegameHeader() { clear(); } + + /** + * Clear the header + */ + void clear(); }; diff --git a/engines/titanic/detection.cpp b/engines/titanic/detection.cpp index 098c20ca1d..5fad72a9df 100644 --- a/engines/titanic/detection.cpp +++ b/engines/titanic/detection.cpp @@ -167,10 +167,13 @@ SaveStateDescriptor TitanicMetaEngine::querySaveMetaInfos(const char *target, in // Create the return descriptor SaveStateDescriptor desc(slot, header._saveName); - desc.setThumbnail(header._thumbnail); - desc.setSaveDate(header._year, header._month, header._day); - desc.setSaveTime(header._hour, header._minute); - desc.setPlayTime(header._totalFrames * GAME_FRAME_TIME); + + if (header._version) { + desc.setThumbnail(header._thumbnail); + desc.setSaveDate(header._year, header._month, header._day); + desc.setSaveTime(header._hour, header._minute); + desc.setPlayTime(header._totalFrames * GAME_FRAME_TIME); + } return desc; } |