1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 06:35:30 +00:00

Chargen cleanup.

Move common gui state pop out of if checks.
Move health update before gui state push (used as input for some windows).
This commit is contained in:
Jordan Ayers 2013-11-05 19:38:45 -06:00
parent d85360e7fd
commit e94da61ff0

View File

@ -332,24 +332,22 @@ namespace MWGui
mPickClassDialog = 0;
}
updatePlayerHealth();
//TODO This bit gets repeated a few times; wrap it in a function
MWBase::Environment::get().getWindowManager()->popGuiMode();
if (mCreationStage == CSE_ReviewNext)
{
MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_ClassChosen)
{
MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
}
else
{
mCreationStage = CSE_ClassChosen;
MWBase::Environment::get().getWindowManager()->popGuiMode();
}
updatePlayerHealth();
}
void CharacterCreation::onPickClassDialogBack()
@ -403,20 +401,18 @@ namespace MWGui
mNameDialog = 0;
}
MWBase::Environment::get().getWindowManager()->popGuiMode();
if (mCreationStage == CSE_ReviewNext)
{
MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_NameChosen)
{
MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Race);
}
else
{
mCreationStage = CSE_NameChosen;
MWBase::Environment::get().getWindowManager()->popGuiMode();
}
}
@ -462,23 +458,21 @@ namespace MWGui
mRaceDialog = 0;
}
updatePlayerHealth();
MWBase::Environment::get().getWindowManager()->popGuiMode();
if (mCreationStage == CSE_ReviewNext)
{
MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_RaceChosen)
{
MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
}
else
{
mCreationStage = CSE_RaceChosen;
MWBase::Environment::get().getWindowManager()->popGuiMode();
}
updatePlayerHealth();
}
void CharacterCreation::onBirthSignDialogDone(WindowBase* parWindow)
@ -492,18 +486,17 @@ namespace MWGui
mBirthSignDialog = 0;
}
updatePlayerHealth();
MWBase::Environment::get().getWindowManager()->popGuiMode();
if (mCreationStage >= CSE_BirthSignChosen)
{
MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
}
else
{
mCreationStage = CSE_BirthSignChosen;
MWBase::Environment::get().getWindowManager()->popGuiMode();
}
updatePlayerHealth();
}
void CharacterCreation::onBirthSignDialogBack()
@ -552,23 +545,21 @@ namespace MWGui
mCreateClassDialog = 0;
}
updatePlayerHealth();
MWBase::Environment::get().getWindowManager()->popGuiMode();
if (mCreationStage == CSE_ReviewNext)
{
MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_ClassChosen)
{
MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
}
else
{
mCreationStage = CSE_ClassChosen;
MWBase::Environment::get().getWindowManager()->popGuiMode();
}
updatePlayerHealth();
}
void CharacterCreation::onCreateClassDialogBack()
@ -722,23 +713,21 @@ namespace MWGui
mPlayerClass = *klass;
MWBase::Environment::get().getWindowManager()->setPlayerClass(mPlayerClass);
updatePlayerHealth();
MWBase::Environment::get().getWindowManager()->popGuiMode();
if (mCreationStage == CSE_ReviewNext)
{
MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_ClassChosen)
{
MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
}
else
{
mCreationStage = CSE_ClassChosen;
MWBase::Environment::get().getWindowManager()->popGuiMode();
}
updatePlayerHealth();
}
CharacterCreation::~CharacterCreation()