mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 05:53:50 +00:00
Properly apply changes when backing out of chargen dialogs (Fixes #2627)
This commit is contained in:
parent
86f0e505e9
commit
0d8f07d563
2 changed files with 56 additions and 56 deletions
|
@ -312,7 +312,7 @@ namespace MWGui
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterCreation::onPickClassDialogDone(WindowBase* parWindow)
|
void CharacterCreation::selectPickedClass()
|
||||||
{
|
{
|
||||||
if (mPickClassDialog)
|
if (mPickClassDialog)
|
||||||
{
|
{
|
||||||
|
@ -332,20 +332,18 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePlayerHealth();
|
updatePlayerHealth();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CharacterCreation::onPickClassDialogDone(WindowBase* parWindow)
|
||||||
|
{
|
||||||
|
selectPickedClass();
|
||||||
|
|
||||||
handleDialogDone(CSE_ClassChosen, GM_Birth);
|
handleDialogDone(CSE_ClassChosen, GM_Birth);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterCreation::onPickClassDialogBack()
|
void CharacterCreation::onPickClassDialogBack()
|
||||||
{
|
{
|
||||||
if (mPickClassDialog)
|
selectPickedClass();
|
||||||
{
|
|
||||||
const std::string classId = mPickClassDialog->getClassId();
|
|
||||||
if (!classId.empty())
|
|
||||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(classId);
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeDialog(mPickClassDialog);
|
|
||||||
mPickClassDialog = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
|
||||||
|
@ -390,29 +388,7 @@ namespace MWGui
|
||||||
handleDialogDone(CSE_NameChosen, GM_Race);
|
handleDialogDone(CSE_NameChosen, GM_Race);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterCreation::onRaceDialogBack()
|
void CharacterCreation::selectRace()
|
||||||
{
|
|
||||||
if (mRaceDialog)
|
|
||||||
{
|
|
||||||
const ESM::NPC &data = mRaceDialog->getResult();
|
|
||||||
mPlayerRaceId = data.mRace;
|
|
||||||
if (!mPlayerRaceId.empty()) {
|
|
||||||
MWBase::Environment::get().getMechanicsManager()->setPlayerRace(
|
|
||||||
data.mRace,
|
|
||||||
data.isMale(),
|
|
||||||
data.mHead,
|
|
||||||
data.mHair
|
|
||||||
);
|
|
||||||
}
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeDialog(mRaceDialog);
|
|
||||||
mRaceDialog = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Name);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CharacterCreation::onRaceDialogDone(WindowBase* parWindow)
|
|
||||||
{
|
{
|
||||||
if (mRaceDialog)
|
if (mRaceDialog)
|
||||||
{
|
{
|
||||||
|
@ -433,11 +409,24 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePlayerHealth();
|
updatePlayerHealth();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CharacterCreation::onRaceDialogBack()
|
||||||
|
{
|
||||||
|
selectRace();
|
||||||
|
|
||||||
|
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||||
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CharacterCreation::onRaceDialogDone(WindowBase* parWindow)
|
||||||
|
{
|
||||||
|
selectRace();
|
||||||
|
|
||||||
handleDialogDone(CSE_RaceChosen, GM_Class);
|
handleDialogDone(CSE_RaceChosen, GM_Class);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterCreation::onBirthSignDialogDone(WindowBase* parWindow)
|
void CharacterCreation::selectBirthSign()
|
||||||
{
|
{
|
||||||
if (mBirthSignDialog)
|
if (mBirthSignDialog)
|
||||||
{
|
{
|
||||||
|
@ -449,24 +438,24 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePlayerHealth();
|
updatePlayerHealth();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CharacterCreation::onBirthSignDialogDone(WindowBase* parWindow)
|
||||||
|
{
|
||||||
|
selectBirthSign();
|
||||||
|
|
||||||
handleDialogDone(CSE_BirthSignChosen, GM_Review);
|
handleDialogDone(CSE_BirthSignChosen, GM_Review);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterCreation::onBirthSignDialogBack()
|
void CharacterCreation::onBirthSignDialogBack()
|
||||||
{
|
{
|
||||||
if (mBirthSignDialog)
|
selectBirthSign();
|
||||||
{
|
|
||||||
MWBase::Environment::get().getMechanicsManager()->setPlayerBirthsign(mBirthSignDialog->getBirthId());
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeDialog(mBirthSignDialog);
|
|
||||||
mBirthSignDialog = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow)
|
void CharacterCreation::selectCreatedClass()
|
||||||
{
|
{
|
||||||
if (mCreateClassDialog)
|
if (mCreateClassDialog)
|
||||||
{
|
{
|
||||||
|
@ -495,19 +484,23 @@ namespace MWGui
|
||||||
mPlayerClass = klass;
|
mPlayerClass = klass;
|
||||||
MWBase::Environment::get().getWindowManager()->setPlayerClass(klass);
|
MWBase::Environment::get().getWindowManager()->setPlayerClass(klass);
|
||||||
|
|
||||||
// Do not delete dialog, so that choices are rembered in case we want to go back and adjust them later
|
// Do not delete dialog, so that choices are remembered in case we want to go back and adjust them later
|
||||||
mCreateClassDialog->setVisible(false);
|
mCreateClassDialog->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePlayerHealth();
|
updatePlayerHealth();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow)
|
||||||
|
{
|
||||||
|
selectCreatedClass();
|
||||||
|
|
||||||
handleDialogDone(CSE_ClassChosen, GM_Birth);
|
handleDialogDone(CSE_ClassChosen, GM_Birth);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterCreation::onCreateClassDialogBack()
|
void CharacterCreation::onCreateClassDialogBack()
|
||||||
{
|
{
|
||||||
// Do not delete dialog, so that choices are rembered in case we want to go back and adjust them later
|
// not done in MW, but we do it for consistency with the other dialogs
|
||||||
mCreateClassDialog->setVisible(false);
|
selectCreatedClass();
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
|
||||||
|
@ -631,18 +624,7 @@ namespace MWGui
|
||||||
MWBase::Environment::get().getSoundManager()->say(sGenerateClassSteps(mGenerateClassStep).mSound);
|
MWBase::Environment::get().getSoundManager()->say(sGenerateClassSteps(mGenerateClassStep).mSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterCreation::onGenerateClassBack()
|
void CharacterCreation::selectGeneratedClass()
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeDialog(mGenerateClassResultDialog);
|
|
||||||
mGenerateClassResultDialog = 0;
|
|
||||||
|
|
||||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
|
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CharacterCreation::onGenerateClassDone(WindowBase* parWindow)
|
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager()->removeDialog(mGenerateClassResultDialog);
|
MWBase::Environment::get().getWindowManager()->removeDialog(mGenerateClassResultDialog);
|
||||||
mGenerateClassResultDialog = 0;
|
mGenerateClassResultDialog = 0;
|
||||||
|
@ -656,6 +638,19 @@ namespace MWGui
|
||||||
MWBase::Environment::get().getWindowManager()->setPlayerClass(mPlayerClass);
|
MWBase::Environment::get().getWindowManager()->setPlayerClass(mPlayerClass);
|
||||||
|
|
||||||
updatePlayerHealth();
|
updatePlayerHealth();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CharacterCreation::onGenerateClassBack()
|
||||||
|
{
|
||||||
|
selectGeneratedClass();
|
||||||
|
|
||||||
|
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||||
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CharacterCreation::onGenerateClassDone(WindowBase* parWindow)
|
||||||
|
{
|
||||||
|
selectGeneratedClass();
|
||||||
|
|
||||||
handleDialogDone(CSE_ClassChosen, GM_Birth);
|
handleDialogDone(CSE_ClassChosen, GM_Birth);
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,7 @@ namespace MWGui
|
||||||
//Race dialog
|
//Race dialog
|
||||||
void onRaceDialogDone(WindowBase* parWindow);
|
void onRaceDialogDone(WindowBase* parWindow);
|
||||||
void onRaceDialogBack();
|
void onRaceDialogBack();
|
||||||
|
void selectRace();
|
||||||
|
|
||||||
//Class dialogs
|
//Class dialogs
|
||||||
void onClassChoice(int _index);
|
void onClassChoice(int _index);
|
||||||
|
@ -94,10 +95,14 @@ namespace MWGui
|
||||||
void onClassQuestionChosen(int _index);
|
void onClassQuestionChosen(int _index);
|
||||||
void onGenerateClassBack();
|
void onGenerateClassBack();
|
||||||
void onGenerateClassDone(WindowBase* parWindow);
|
void onGenerateClassDone(WindowBase* parWindow);
|
||||||
|
void selectGeneratedClass();
|
||||||
|
void selectCreatedClass();
|
||||||
|
void selectPickedClass();
|
||||||
|
|
||||||
//Birthsign dialog
|
//Birthsign dialog
|
||||||
void onBirthSignDialogDone(WindowBase* parWindow);
|
void onBirthSignDialogDone(WindowBase* parWindow);
|
||||||
void onBirthSignDialogBack();
|
void onBirthSignDialogBack();
|
||||||
|
void selectBirthSign();
|
||||||
|
|
||||||
//Review dialog
|
//Review dialog
|
||||||
void onReviewDialogDone(WindowBase* parWindow);
|
void onReviewDialogDone(WindowBase* parWindow);
|
||||||
|
|
Loading…
Reference in a new issue