savegamedialog: don't reset the character selection scrollbar when a character is deleted

This commit is contained in:
scrawl 2016-09-18 19:25:51 +02:00
parent 8f5347b79b
commit 30d5c7488d

View file

@ -91,15 +91,17 @@ namespace MWGui
if (mSaveList->getItemCount() == 0)
{
// The character might be deleted now
size_t previousIndex = mCharacterSelection->getIndexSelected();
open();
mCurrentCharacter = NULL;
mCharacterSelection->removeItemAt(previousIndex);
if (mCharacterSelection->getItemCount())
{
size_t nextCharacter = std::min(previousIndex, mCharacterSelection->getItemCount()-1);
mCharacterSelection->setIndexSelected(nextCharacter);
onCharacterSelected(mCharacterSelection, nextCharacter);
}
else
fillSaveList();
}
}