1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 06:53:53 +00:00

Chargen Review Dialog: Init fix.

Load the starting Health/Magicka/Fatigue from the player stats when
creating the Review Dialog, and remove the extra copy of these stats.
In some cases, the old stat values were never updated from 0/0.
This commit is contained in:
Jordan Ayers 2013-11-05 19:42:55 -06:00
parent d48cc27a89
commit 3fbf918751
3 changed files with 9 additions and 31 deletions

View file

@ -219,9 +219,14 @@ namespace MWGui
mReviewDialog->setClass(mPlayerClass);
mReviewDialog->setBirthSign(mPlayerBirthSignId);
mReviewDialog->setHealth(mPlayerHealth);
mReviewDialog->setMagicka(mPlayerMagicka);
mReviewDialog->setFatigue(mPlayerFatigue);
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
MWMechanics::CreatureStats stats = MWWorld::Class::get(player).getCreatureStats(player);
mReviewDialog->setHealth ( stats.getHealth() );
mReviewDialog->setMagicka( stats.getMagicka() );
mReviewDialog->setFatigue( stats.getFatigue() );
}
{
std::map<int, MWMechanics::Stat<int> > attributes = MWBase::Environment::get().getWindowManager()->getPlayerAttributeValues();
@ -258,21 +263,6 @@ namespace MWGui
mRaceDialog->doRenderUpdate();
}
void CharacterCreation::setPlayerHealth (const MWMechanics::DynamicStat<float>& value)
{
mPlayerHealth = value;
}
void CharacterCreation::setPlayerMagicka (const MWMechanics::DynamicStat<float>& value)
{
mPlayerMagicka = value;
}
void CharacterCreation::setPlayerFatigue (const MWMechanics::DynamicStat<float>& value)
{
mPlayerFatigue = value;
}
void CharacterCreation::onReviewDialogDone(WindowBase* parWindow)
{
MWBase::Environment::get().getWindowManager()->removeDialog(mReviewDialog);

View file

@ -31,12 +31,6 @@ namespace MWGui
//Show a dialog
void spawnDialog(const char id);
void setPlayerHealth (const MWMechanics::DynamicStat<float>& value);
void setPlayerMagicka (const MWMechanics::DynamicStat<float>& value);
void setPlayerFatigue (const MWMechanics::DynamicStat<float>& value);
void setValue (const std::string& id, const MWMechanics::Stat<int>& value);
void setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value);
void setValue(const ESM::Skill::SkillEnum parSkill, const MWMechanics::Stat<float>& value);
@ -60,9 +54,6 @@ namespace MWGui
std::string mPlayerRaceId;
std::string mPlayerBirthSignId;
ESM::Class mPlayerClass;
MWMechanics::DynamicStat<float> mPlayerHealth;
MWMechanics::DynamicStat<float> mPlayerMagicka;
MWMechanics::DynamicStat<float> mPlayerFatigue;
//Class generation vars
unsigned mGenerateClassStep; // Keeps track of current step in Generate Class dialog

View file

@ -581,17 +581,14 @@ namespace MWGui
if (id == "HBar")
{
mPlayerHealth = value;
mCharGen->setPlayerHealth (value);
}
else if (id == "MBar")
{
mPlayerMagicka = value;
mCharGen->setPlayerMagicka (value);
}
else if (id == "FBar")
{
mPlayerFatigue = value;
mCharGen->setPlayerFatigue (value);
}
}
@ -599,7 +596,7 @@ namespace MWGui
MWMechanics::DynamicStat<int> WindowManager::getValue(const std::string& id)
{
if(id == "HBar")
return layerHealth;
return mPlayerHealth;
else if (id == "MBar")
return mPlayerMagicka;
else if (id == "FBar")