From f3f93da8b8a2770d830e7b66ae76fdd028adeaed Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 20 Dec 2008 23:15:46 +0000 Subject: - Added comment about error check when loading save on startup - Updated code to properly test the last three digits of save filenames instead of only the last two svn-id: r35455 --- engines/tinsel/detection.cpp | 6 +++--- engines/tinsel/tinsel.cpp | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'engines/tinsel') diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp index ec1a6310ef..e5c5678435 100644 --- a/engines/tinsel/detection.cpp +++ b/engines/tinsel/detection.cpp @@ -486,8 +486,8 @@ SaveStateList TinselMetaEngine::listSaves(const char *target) const { SaveStateList saveList; int slotNum = 0; for (Common::StringList::const_iterator file = files.begin(); file != files.end(); ++file) { - // Obtain the last 2 digits of the filename, since they correspond to the save slot - slotNum = atoi(file->c_str() + file->size() - 2); + // Obtain the last 3 digits of the filename, since they correspond to the save slot + slotNum = atoi(file->c_str() + file->size() - 3); const Common::String &fname = *file; Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(fname.c_str()); @@ -563,7 +563,7 @@ Common::Error TinselEngine::loadGameState(int slot) { const int numStates = Tinsel::getList(); for (int i = 0; i < numStates; ++i) { const char *fileName = Tinsel::ListEntry(i, Tinsel::LE_NAME); - const int saveSlot = atoi(fileName + strlen(fileName) - 2); + const int saveSlot = atoi(fileName + strlen(fileName) - 3); if (saveSlot == slot) { listSlot = i; diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp index e9bd50e142..ddfde0df6d 100644 --- a/engines/tinsel/tinsel.cpp +++ b/engines/tinsel/tinsel.cpp @@ -992,6 +992,9 @@ Common::Error TinselEngine::go() { //dumpMusic(); // dumps all of the game's music in external XMIDI files // Load game from specified slot, if any + // + // TODO: We might want to think about taking care of possible errors + // when loading the save state. if (ConfMan.hasKey("save_slot")) loadGameState(ConfMan.getInt("save_slot")); -- cgit v1.2.3