Skip to content

Commit

Permalink
KYRA: Never allow slots 0 and 990-999 to be overwritten.
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Schickel committed Oct 1, 2011
1 parent 5ea975a commit 74f3a29
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions engines/kyra/detection.cpp
Expand Up @@ -187,6 +187,7 @@ void KyraMetaEngine::removeSaveState(const char *target, int slot) const {
SaveStateDescriptor KyraMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
Common::String filename = Kyra::KyraEngine_v1::getSavegameFilename(target, slot);
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename);
const bool lolGame = ConfMan.getDomain(target)->getVal("gameid").equalsIgnoreCase("lol");

if (in) {
Kyra::KyraEngine_v1::SaveHeader header;
Expand All @@ -198,22 +199,28 @@ SaveStateDescriptor KyraMetaEngine::querySaveMetaInfos(const char *target, int s
if (error == Kyra::KyraEngine_v1::kRSHENoError) {
SaveStateDescriptor desc(slot, header.description);

bool lolGame = ConfMan.getDomain(target)->getVal("gameid").equalsIgnoreCase("lol");

// Slot 0 is used for the 'restart game' save in all three Kyrandia games, thus
// we prevent it from being deleted.
desc.setDeletableFlag(slot != 0 || lolGame);

// We don't allow quick saves (slot 990 till 998) to be overwritten.
// The same goes for the 'Autosave', which is slot 999.
// The same goes for the 'Autosave', which is slot 999. Slot 0 will also
// be protected in Kyra 1-3, since it's the 'restart game' save.
desc.setWriteProtectedFlag((slot == 0 && !lolGame) || slot >= 990);
desc.setThumbnail(header.thumbnail);

return desc;
}
}

return SaveStateDescriptor();
SaveStateDescriptor desc(slot, Common::String());

// We don't allow quick saves (slot 990 till 998) to be overwritten.
// The same goes for the 'Autosave', which is slot 999. Slot 0 will also
// be protected in Kyra 1-3, since it's the 'restart game' save.
desc.setWriteProtectedFlag((slot == 0 && !lolGame) || slot >= 990);

return desc;
}

#if PLUGIN_ENABLED_DYNAMIC(KYRA)
Expand Down

0 comments on commit 74f3a29

Please sign in to comment.