From 2c9fdf0df754176a375d5079c7e8578c6701630a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 7 Aug 2011 14:21:28 +0300 Subject: TINSEL: Fixed deleting saved games from the launcher (bug #3387551) --- engines/tinsel/detection.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'engines/tinsel/detection.cpp') diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp index 9c52305a1c..1fce032633 100644 --- a/engines/tinsel/detection.cpp +++ b/engines/tinsel/detection.cpp @@ -322,9 +322,21 @@ int TinselMetaEngine::getMaximumSaveSlot() const { return 99; } void TinselMetaEngine::removeSaveState(const char *target, int slot) const { Tinsel::setNeedLoad(); - Tinsel::getList(g_system->getSavefileManager(), target); + // Same issue here as with loadGameState(): we need the physical savegame + // slot. Refer to bug #3387551. + int listSlot = -1; + const int numStates = Tinsel::getList(g_system->getSavefileManager(), target); + for (int i = 0; i < numStates; ++i) { + const char *fileName = Tinsel::ListEntry(i, Tinsel::LE_NAME); + const int saveSlot = atoi(fileName + strlen(fileName) - 3); + + if (saveSlot == slot) { + listSlot = i; + break; + } + } - g_system->getSavefileManager()->removeSavefile(Tinsel::ListEntry(slot, Tinsel::LE_NAME)); + g_system->getSavefileManager()->removeSavefile(Tinsel::ListEntry(listSlot, Tinsel::LE_NAME)); Tinsel::setNeedLoad(); Tinsel::getList(g_system->getSavefileManager(), target); } -- cgit v1.2.3