1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-21 09:39:56 +00:00

fixed handling of characters without a valid slot

This commit is contained in:
Marc Zinnschlag 2013-11-24 15:05:00 +01:00
parent 18a3b38fb4
commit 7efac4c9a5
3 changed files with 10 additions and 15 deletions

View File

@ -63,8 +63,6 @@ namespace MWBase
/// \note \a slot must belong to \a character.
virtual MWState::Character *getCurrentCharacter() = 0;
///< \attention Do not call this function to check if there is a current character.
/// Instead, assume there is a character if getState() == Running.
virtual CharacterIterator characterBegin() = 0;
///< Any call to SaveGame and getCurrentCharacter can invalidate the returned

View File

@ -89,23 +89,22 @@ namespace MWGui
if (mgr->characterBegin() == mgr->characterEnd())
return;
// If we are running, there must be a current character
if (mgr->getState() == MWBase::StateManager::State_Running)
{
mCurrentCharacter = mgr->getCurrentCharacter();
}
mCurrentCharacter = mgr->getCurrentCharacter();
mCharacterSelection->removeAllItems();
for (MWBase::StateManager::CharacterIterator it = mgr->characterBegin(); it != mgr->characterEnd(); ++it)
{
std::stringstream title;
title << it->getSignature().mPlayerName;
title << " (Level " << it->getSignature().mPlayerLevel << " " << it->getSignature().mPlayerClass << ")";
if (it->begin()!=it->end())
{
std::stringstream title;
title << it->getSignature().mPlayerName;
title << " (Level " << it->getSignature().mPlayerLevel << " " << it->getSignature().mPlayerClass << ")";
mCharacterSelection->addItem (title.str());
mCharacterSelection->addItem (title.str());
if (mCurrentCharacter == &*it)
mCharacterSelection->setIndexSelected(mCharacterSelection->getItemCount()-1);
if (mgr->getCurrentCharacter() == &*it)
mCharacterSelection->setIndexSelected(mCharacterSelection->getItemCount()-1);
}
}
fillSaveList();

View File

@ -43,8 +43,6 @@ namespace MWState
/// \note \a slot must belong to \a character.
virtual Character *getCurrentCharacter();
///< \attention Do not call this function to check if there is a current character. Use
/// characterBegin()!=characterEnd() instead.
virtual CharacterIterator characterBegin();
///< Any call to SaveGame and getCurrentCharacter can invalidate the returned