mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Print exceptions in CharacterCreation::spawnDialog
This commit is contained in:
parent
f1b52c964a
commit
dca4704b4b
@ -132,134 +132,141 @@ namespace MWGui
|
||||
|
||||
void CharacterCreation::spawnDialog(const char id)
|
||||
{
|
||||
switch (id)
|
||||
try
|
||||
{
|
||||
case GM_Name:
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mNameDialog);
|
||||
mNameDialog = 0;
|
||||
mNameDialog = new TextInputDialog();
|
||||
mNameDialog->setTextLabel(MWBase::Environment::get().getWindowManager()->getGameSettingString("sName", "Name"));
|
||||
mNameDialog->setTextInput(mPlayerName);
|
||||
mNameDialog->setNextButtonShow(mCreationStage >= CSE_NameChosen);
|
||||
mNameDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onNameDialogDone);
|
||||
mNameDialog->setVisible(true);
|
||||
break;
|
||||
switch (id)
|
||||
{
|
||||
case GM_Name:
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mNameDialog);
|
||||
mNameDialog = 0;
|
||||
mNameDialog = new TextInputDialog();
|
||||
mNameDialog->setTextLabel(MWBase::Environment::get().getWindowManager()->getGameSettingString("sName", "Name"));
|
||||
mNameDialog->setTextInput(mPlayerName);
|
||||
mNameDialog->setNextButtonShow(mCreationStage >= CSE_NameChosen);
|
||||
mNameDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onNameDialogDone);
|
||||
mNameDialog->setVisible(true);
|
||||
break;
|
||||
|
||||
case GM_Race:
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mRaceDialog);
|
||||
mRaceDialog = 0;
|
||||
mRaceDialog = new RaceDialog(mViewer, mResourceSystem);
|
||||
mRaceDialog->setNextButtonShow(mCreationStage >= CSE_RaceChosen);
|
||||
mRaceDialog->setRaceId(mPlayerRaceId);
|
||||
mRaceDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onRaceDialogDone);
|
||||
mRaceDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onRaceDialogBack);
|
||||
mRaceDialog->setVisible(true);
|
||||
if (mCreationStage < CSE_NameChosen)
|
||||
mCreationStage = CSE_NameChosen;
|
||||
break;
|
||||
case GM_Race:
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mRaceDialog);
|
||||
mRaceDialog = 0;
|
||||
mRaceDialog = new RaceDialog(mViewer, mResourceSystem);
|
||||
mRaceDialog->setNextButtonShow(mCreationStage >= CSE_RaceChosen);
|
||||
mRaceDialog->setRaceId(mPlayerRaceId);
|
||||
mRaceDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onRaceDialogDone);
|
||||
mRaceDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onRaceDialogBack);
|
||||
mRaceDialog->setVisible(true);
|
||||
if (mCreationStage < CSE_NameChosen)
|
||||
mCreationStage = CSE_NameChosen;
|
||||
break;
|
||||
|
||||
case GM_Class:
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mClassChoiceDialog);
|
||||
mClassChoiceDialog = 0;
|
||||
mClassChoiceDialog = new ClassChoiceDialog();
|
||||
mClassChoiceDialog->eventButtonSelected += MyGUI::newDelegate(this, &CharacterCreation::onClassChoice);
|
||||
mClassChoiceDialog->setVisible(true);
|
||||
if (mCreationStage < CSE_RaceChosen)
|
||||
mCreationStage = CSE_RaceChosen;
|
||||
break;
|
||||
case GM_Class:
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mClassChoiceDialog);
|
||||
mClassChoiceDialog = 0;
|
||||
mClassChoiceDialog = new ClassChoiceDialog();
|
||||
mClassChoiceDialog->eventButtonSelected += MyGUI::newDelegate(this, &CharacterCreation::onClassChoice);
|
||||
mClassChoiceDialog->setVisible(true);
|
||||
if (mCreationStage < CSE_RaceChosen)
|
||||
mCreationStage = CSE_RaceChosen;
|
||||
break;
|
||||
|
||||
case GM_ClassPick:
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mPickClassDialog);
|
||||
mPickClassDialog = 0;
|
||||
mPickClassDialog = new PickClassDialog();
|
||||
mPickClassDialog->setNextButtonShow(mCreationStage >= CSE_ClassChosen);
|
||||
mPickClassDialog->setClassId(mPlayerClass.mName);
|
||||
mPickClassDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onPickClassDialogDone);
|
||||
mPickClassDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onPickClassDialogBack);
|
||||
mPickClassDialog->setVisible(true);
|
||||
if (mCreationStage < CSE_RaceChosen)
|
||||
mCreationStage = CSE_RaceChosen;
|
||||
break;
|
||||
case GM_ClassPick:
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mPickClassDialog);
|
||||
mPickClassDialog = 0;
|
||||
mPickClassDialog = new PickClassDialog();
|
||||
mPickClassDialog->setNextButtonShow(mCreationStage >= CSE_ClassChosen);
|
||||
mPickClassDialog->setClassId(mPlayerClass.mName);
|
||||
mPickClassDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onPickClassDialogDone);
|
||||
mPickClassDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onPickClassDialogBack);
|
||||
mPickClassDialog->setVisible(true);
|
||||
if (mCreationStage < CSE_RaceChosen)
|
||||
mCreationStage = CSE_RaceChosen;
|
||||
break;
|
||||
|
||||
case GM_Birth:
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mBirthSignDialog);
|
||||
mBirthSignDialog = 0;
|
||||
mBirthSignDialog = new BirthDialog();
|
||||
mBirthSignDialog->setNextButtonShow(mCreationStage >= CSE_BirthSignChosen);
|
||||
mBirthSignDialog->setBirthId(mPlayerBirthSignId);
|
||||
mBirthSignDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogDone);
|
||||
mBirthSignDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogBack);
|
||||
mBirthSignDialog->setVisible(true);
|
||||
if (mCreationStage < CSE_ClassChosen)
|
||||
mCreationStage = CSE_ClassChosen;
|
||||
break;
|
||||
case GM_Birth:
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mBirthSignDialog);
|
||||
mBirthSignDialog = 0;
|
||||
mBirthSignDialog = new BirthDialog();
|
||||
mBirthSignDialog->setNextButtonShow(mCreationStage >= CSE_BirthSignChosen);
|
||||
mBirthSignDialog->setBirthId(mPlayerBirthSignId);
|
||||
mBirthSignDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogDone);
|
||||
mBirthSignDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogBack);
|
||||
mBirthSignDialog->setVisible(true);
|
||||
if (mCreationStage < CSE_ClassChosen)
|
||||
mCreationStage = CSE_ClassChosen;
|
||||
break;
|
||||
|
||||
case GM_ClassCreate:
|
||||
if (!mCreateClassDialog)
|
||||
{
|
||||
mCreateClassDialog = new CreateClassDialog();
|
||||
mCreateClassDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onCreateClassDialogDone);
|
||||
mCreateClassDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onCreateClassDialogBack);
|
||||
}
|
||||
mCreateClassDialog->setNextButtonShow(mCreationStage >= CSE_ClassChosen);
|
||||
mCreateClassDialog->setVisible(true);
|
||||
if (mCreationStage < CSE_RaceChosen)
|
||||
mCreationStage = CSE_RaceChosen;
|
||||
break;
|
||||
case GM_ClassGenerate:
|
||||
mGenerateClassStep = 0;
|
||||
mGenerateClass = "";
|
||||
mGenerateClassSpecializations[0] = 0;
|
||||
mGenerateClassSpecializations[1] = 0;
|
||||
mGenerateClassSpecializations[2] = 0;
|
||||
showClassQuestionDialog();
|
||||
if (mCreationStage < CSE_RaceChosen)
|
||||
mCreationStage = CSE_RaceChosen;
|
||||
break;
|
||||
case GM_Review:
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mReviewDialog);
|
||||
mReviewDialog = 0;
|
||||
mReviewDialog = new ReviewDialog();
|
||||
mReviewDialog->setPlayerName(mPlayerName);
|
||||
mReviewDialog->setRace(mPlayerRaceId);
|
||||
mReviewDialog->setClass(mPlayerClass);
|
||||
mReviewDialog->setBirthSign(mPlayerBirthSignId);
|
||||
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
|
||||
mReviewDialog->setHealth ( stats.getHealth() );
|
||||
mReviewDialog->setMagicka( stats.getMagicka() );
|
||||
mReviewDialog->setFatigue( stats.getFatigue() );
|
||||
}
|
||||
|
||||
{
|
||||
std::map<int, MWMechanics::AttributeValue > attributes = MWBase::Environment::get().getWindowManager()->getPlayerAttributeValues();
|
||||
for (std::map<int, MWMechanics::AttributeValue >::iterator it = attributes.begin();
|
||||
it != attributes.end(); ++it)
|
||||
case GM_ClassCreate:
|
||||
if (!mCreateClassDialog)
|
||||
{
|
||||
mReviewDialog->setAttribute(static_cast<ESM::Attribute::AttributeID> (it->first), it->second);
|
||||
mCreateClassDialog = new CreateClassDialog();
|
||||
mCreateClassDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onCreateClassDialogDone);
|
||||
mCreateClassDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onCreateClassDialogBack);
|
||||
}
|
||||
}
|
||||
mCreateClassDialog->setNextButtonShow(mCreationStage >= CSE_ClassChosen);
|
||||
mCreateClassDialog->setVisible(true);
|
||||
if (mCreationStage < CSE_RaceChosen)
|
||||
mCreationStage = CSE_RaceChosen;
|
||||
break;
|
||||
case GM_ClassGenerate:
|
||||
mGenerateClassStep = 0;
|
||||
mGenerateClass = "";
|
||||
mGenerateClassSpecializations[0] = 0;
|
||||
mGenerateClassSpecializations[1] = 0;
|
||||
mGenerateClassSpecializations[2] = 0;
|
||||
showClassQuestionDialog();
|
||||
if (mCreationStage < CSE_RaceChosen)
|
||||
mCreationStage = CSE_RaceChosen;
|
||||
break;
|
||||
case GM_Review:
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mReviewDialog);
|
||||
mReviewDialog = 0;
|
||||
mReviewDialog = new ReviewDialog();
|
||||
mReviewDialog->setPlayerName(mPlayerName);
|
||||
mReviewDialog->setRace(mPlayerRaceId);
|
||||
mReviewDialog->setClass(mPlayerClass);
|
||||
mReviewDialog->setBirthSign(mPlayerBirthSignId);
|
||||
|
||||
{
|
||||
std::map<int, MWMechanics::SkillValue > skills = MWBase::Environment::get().getWindowManager()->getPlayerSkillValues();
|
||||
for (std::map<int, MWMechanics::SkillValue >::iterator it = skills.begin();
|
||||
it != skills.end(); ++it)
|
||||
{
|
||||
mReviewDialog->setSkillValue(static_cast<ESM::Skill::SkillEnum> (it->first), it->second);
|
||||
}
|
||||
mReviewDialog->configureSkills(MWBase::Environment::get().getWindowManager()->getPlayerMajorSkills(), MWBase::Environment::get().getWindowManager()->getPlayerMinorSkills());
|
||||
}
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
|
||||
mReviewDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onReviewDialogDone);
|
||||
mReviewDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onReviewDialogBack);
|
||||
mReviewDialog->eventActivateDialog += MyGUI::newDelegate(this, &CharacterCreation::onReviewActivateDialog);
|
||||
mReviewDialog->setVisible(true);
|
||||
if (mCreationStage < CSE_BirthSignChosen)
|
||||
mCreationStage = CSE_BirthSignChosen;
|
||||
break;
|
||||
mReviewDialog->setHealth ( stats.getHealth() );
|
||||
mReviewDialog->setMagicka( stats.getMagicka() );
|
||||
mReviewDialog->setFatigue( stats.getFatigue() );
|
||||
}
|
||||
|
||||
{
|
||||
std::map<int, MWMechanics::AttributeValue > attributes = MWBase::Environment::get().getWindowManager()->getPlayerAttributeValues();
|
||||
for (std::map<int, MWMechanics::AttributeValue >::iterator it = attributes.begin();
|
||||
it != attributes.end(); ++it)
|
||||
{
|
||||
mReviewDialog->setAttribute(static_cast<ESM::Attribute::AttributeID> (it->first), it->second);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
std::map<int, MWMechanics::SkillValue > skills = MWBase::Environment::get().getWindowManager()->getPlayerSkillValues();
|
||||
for (std::map<int, MWMechanics::SkillValue >::iterator it = skills.begin();
|
||||
it != skills.end(); ++it)
|
||||
{
|
||||
mReviewDialog->setSkillValue(static_cast<ESM::Skill::SkillEnum> (it->first), it->second);
|
||||
}
|
||||
mReviewDialog->configureSkills(MWBase::Environment::get().getWindowManager()->getPlayerMajorSkills(), MWBase::Environment::get().getWindowManager()->getPlayerMinorSkills());
|
||||
}
|
||||
|
||||
mReviewDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onReviewDialogDone);
|
||||
mReviewDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onReviewDialogBack);
|
||||
mReviewDialog->eventActivateDialog += MyGUI::newDelegate(this, &CharacterCreation::onReviewActivateDialog);
|
||||
mReviewDialog->setVisible(true);
|
||||
if (mCreationStage < CSE_BirthSignChosen)
|
||||
mCreationStage = CSE_BirthSignChosen;
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
std::cerr << "Failed to create chargen window: " << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user