1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 10:23:56 +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->setClass(mPlayerClass);
mReviewDialog->setBirthSign(mPlayerBirthSignId); mReviewDialog->setBirthSign(mPlayerBirthSignId);
mReviewDialog->setHealth(mPlayerHealth); {
mReviewDialog->setMagicka(mPlayerMagicka); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
mReviewDialog->setFatigue(mPlayerFatigue); 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(); std::map<int, MWMechanics::Stat<int> > attributes = MWBase::Environment::get().getWindowManager()->getPlayerAttributeValues();
@ -258,21 +263,6 @@ namespace MWGui
mRaceDialog->doRenderUpdate(); 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) void CharacterCreation::onReviewDialogDone(WindowBase* parWindow)
{ {
MWBase::Environment::get().getWindowManager()->removeDialog(mReviewDialog); MWBase::Environment::get().getWindowManager()->removeDialog(mReviewDialog);

View file

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

View file

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