From 2a86432887545756c52cd627f7681ab280df3b23 Mon Sep 17 00:00:00 2001 From: greye Date: Thu, 8 Nov 2012 18:50:18 +0400 Subject: [PATCH] store birthsign in MWWorld::Player --- apps/openmw/mwbase/world.hpp | 2 +- apps/openmw/mwgui/stats_window.cpp | 10 +++++----- apps/openmw/mwmechanics/mechanicsmanagerimp.cpp | 9 ++++++--- apps/openmw/mwmechanics/mechanicsmanagerimp.hpp | 1 - apps/openmw/mwworld/player.hpp | 9 +++++++++ 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp index 54cb12c59..199b563da 100644 --- a/apps/openmw/mwbase/world.hpp +++ b/apps/openmw/mwbase/world.hpp @@ -252,7 +252,7 @@ namespace MWBase virtual const ESM::NPC *createRecord(const ESM::NPC &record) = 0; ///< Create a new recrod (of type npc) in the ESM store. - ///< \note special treatment for 'player' record + /// \note special treatment for 'player' record /// \return ID, pointer to created record virtual void playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName, diff --git a/apps/openmw/mwgui/stats_window.cpp b/apps/openmw/mwgui/stats_window.cpp index a557539b7..4b47bb025 100644 --- a/apps/openmw/mwgui/stats_window.cpp +++ b/apps/openmw/mwgui/stats_window.cpp @@ -252,12 +252,12 @@ void StatsWindow::onFrame () } setFactions(PCstats.getFactionRanks()); -/* - const ESM::BirthSign *sign = - MWBase::Environment::get().getWorld()->getPlayer().getBirthsign(); - setBirthSign((sign != 0) ? sign->mId : ""); -*/ + const std::string &signId = + MWBase::Environment::get().getWorld()->getPlayer().getBirthSign(); + + setBirthSign(signId); + if (mChanged) updateSkillArea(); } diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index be675d1bd..50868eeb3 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -90,10 +90,13 @@ namespace MWMechanics } // birthsign - if (!mSign.empty()) + const std::string &signId = + MWBase::Environment::get().getWorld()->getPlayer().getBirthSign(); + + if (!signId.empty()) { const ESM::BirthSign *sign = - esmStore.get().find(mSign); + esmStore.get().find(signId); for (std::vector::const_iterator iter (sign->mPowers.mList.begin()); iter!=sign->mPowers.mList.end(); ++iter) @@ -338,7 +341,7 @@ namespace MWMechanics void MechanicsManager::setPlayerBirthsign (const std::string& id) { - mSign = id; + MWBase::Environment::get().getWorld()->getPlayer().setBirthSign(id); buildPlayer(); mUpdatePlayer = true; } diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp index cc4d8c46a..38536d3bd 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp @@ -29,7 +29,6 @@ namespace MWMechanics bool mUpdatePlayer; bool mClassSelected; bool mRaceSelected; - std::string mSign; Actors mActors; void buildPlayer(); diff --git a/apps/openmw/mwworld/player.hpp b/apps/openmw/mwworld/player.hpp index 7c5ac0018..1c1ef76cf 100644 --- a/apps/openmw/mwworld/player.hpp +++ b/apps/openmw/mwworld/player.hpp @@ -21,6 +21,7 @@ namespace MWWorld { LiveCellRef mPlayer; MWWorld::CellStore *mCellStore; + std::string mSign; bool mAutoMove; int mForwardBackward; @@ -40,6 +41,14 @@ namespace MWWorld return ptr; } + void setBirthSign(const std::string &sign) { + mSign = sign; + } + + const std::string &getBirthSign() const { + return mSign; + } + void setDrawState (MWMechanics::DrawState_ state); bool getAutoMove() const