From 02016f4c56bd83a6a55ccf2482a6aefd8190a05f Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 29 Mar 2016 01:26:55 +0200 Subject: [PATCH] Don't reset the save list when deleting a save (Fixes #3279) --- apps/openmw/mwgui/savegamedialog.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/apps/openmw/mwgui/savegamedialog.cpp b/apps/openmw/mwgui/savegamedialog.cpp index 946eac4d9..b3f04ae40 100644 --- a/apps/openmw/mwgui/savegamedialog.cpp +++ b/apps/openmw/mwgui/savegamedialog.cpp @@ -86,16 +86,19 @@ namespace MWGui { MWBase::Environment::get().getStateManager()->deleteGame (mCurrentCharacter, mCurrentSlot); mSaveList->removeItemAt(mSaveList->getIndexSelected()); - onSlotSelected(mSaveList, MyGUI::ITEM_NONE); + onSlotSelected(mSaveList, mSaveList->getIndexSelected()); - // The character might be deleted now - size_t previousIndex = mCharacterSelection->getIndexSelected(); - open(); - if (mCharacterSelection->getItemCount()) + if (mSaveList->getItemCount() == 0) { - size_t nextCharacter = std::min(previousIndex, mCharacterSelection->getItemCount()-1); - mCharacterSelection->setIndexSelected(nextCharacter); - onCharacterSelected(mCharacterSelection, nextCharacter); + // The character might be deleted now + size_t previousIndex = mCharacterSelection->getIndexSelected(); + open(); + if (mCharacterSelection->getItemCount()) + { + size_t nextCharacter = std::min(previousIndex, mCharacterSelection->getItemCount()-1); + mCharacterSelection->setIndexSelected(nextCharacter); + onCharacterSelected(mCharacterSelection, nextCharacter); + } } }