Skip to content

Commit

Permalink
TITANIC: Don't show invalid meta info for original game saves
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Aug 5, 2017
1 parent 9d2ca34 commit 503b9c1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
13 changes: 13 additions & 0 deletions engines/titanic/core/project_item.cpp
Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions engines/titanic/core/project_item.h
Expand Up @@ -42,6 +42,13 @@ struct TitanicSavegameHeader {
int _year, _month, _day;
int _hour, _minute;
int _totalFrames;

TitanicSavegameHeader() { clear(); }

/**
* Clear the header
*/
void clear();
};


Expand Down
11 changes: 7 additions & 4 deletions engines/titanic/detection.cpp
Expand Up @@ -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;
}
Expand Down

0 comments on commit 503b9c1

Please sign in to comment.