diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 5ab195e64..708065024 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -227,7 +227,7 @@ public: { return weap.type == type; } }; -std::string CharacterController::chooseRandomGroup (const std::string& prefix, int* num) +std::string CharacterController::chooseRandomGroup (const std::string& prefix, int* num) const { int numAnims=0; while (mAnimation->hasAnimation(prefix + toString(numAnims+1))) @@ -629,7 +629,7 @@ void CharacterController::playDeath(float startpoint, CharacterState death) false, 1.0f, "start", "stop", startpoint, 0); } -CharacterState CharacterController::chooseRandomDeathState() +CharacterState CharacterController::chooseRandomDeathState() const { int selected=0; chooseRandomGroup("death", &selected); diff --git a/apps/openmw/mwmechanics/character.hpp b/apps/openmw/mwmechanics/character.hpp index 685bdf1cb..757e2a19f 100644 --- a/apps/openmw/mwmechanics/character.hpp +++ b/apps/openmw/mwmechanics/character.hpp @@ -207,12 +207,12 @@ class CharacterController : public MWRender::Animation::TextKeyListener void updateMagicEffects(); void playDeath(float startpoint, CharacterState death); - CharacterState chooseRandomDeathState(); + CharacterState chooseRandomDeathState() const; void playRandomDeath(float startpoint = 0.0f); /// choose a random animation group with \a prefix and numeric suffix /// @param num if non-NULL, the chosen animation number will be written here - std::string chooseRandomGroup (const std::string& prefix, int* num = NULL); + std::string chooseRandomGroup (const std::string& prefix, int* num = NULL) const; bool updateCarriedLeftVisible(WeaponType weaptype) const; diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 5435a8c58..c049fa62e 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -259,7 +259,7 @@ namespace MWRender ControllerMap mControllerMap[Animation::sNumBlendMasks]; - const std::multimap& getTextKeys(); + const std::multimap& getTextKeys() const; }; class ResetAccumRootCallback : public osg::NodeCallback @@ -314,7 +314,7 @@ namespace MWRender mInsert->removeChild(mObjectRoot); } - MWWorld::Ptr Animation::getPtr() + MWWorld::ConstPtr Animation::getPtr() const { return mPtr; } @@ -338,7 +338,7 @@ namespace MWRender mResetAccumRootCallback->setAccumulate(mAccumulate); } - size_t Animation::detectBlendMask(osg::Node* node) + size_t Animation::detectBlendMask(const osg::Node* node) const { static const char sBlendMaskRoots[sNumBlendMasks][32] = { "", /* Lower body / character root */ @@ -364,7 +364,7 @@ namespace MWRender return 0; } - const std::multimap &Animation::AnimSource::getTextKeys() + const std::multimap &Animation::AnimSource::getTextKeys() const { return mKeyframes->mTextKeys; } @@ -441,7 +441,7 @@ namespace MWRender mAnimSources.clear(); } - bool Animation::hasAnimation(const std::string &anim) + bool Animation::hasAnimation(const std::string &anim) const { AnimSourceList::const_iterator iter(mAnimSources.begin()); for(;iter != mAnimSources.end();++iter) @@ -1098,7 +1098,7 @@ namespace MWRender } // TODO: Should not be here - osg::Vec4f Animation::getEnchantmentColor(MWWorld::Ptr item) + osg::Vec4f Animation::getEnchantmentColor(const MWWorld::ConstPtr& item) const { osg::Vec4f result(1,1,1,1); std::string enchantmentName = item.getClass().getEnchantment(item); @@ -1198,9 +1198,9 @@ namespace MWRender } } - void Animation::getLoopingEffects(std::vector &out) + void Animation::getLoopingEffects(std::vector &out) const { - for (std::vector::iterator it = mEffects.begin(); it != mEffects.end(); ++it) + for (std::vector::const_iterator it = mEffects.begin(); it != mEffects.end(); ++it) { if (it->mLoop) out.push_back(it->mEffectId); diff --git a/apps/openmw/mwrender/animation.hpp b/apps/openmw/mwrender/animation.hpp index 1d7930566..e9d79ced1 100644 --- a/apps/openmw/mwrender/animation.hpp +++ b/apps/openmw/mwrender/animation.hpp @@ -270,7 +270,7 @@ protected: */ void resetActiveGroups(); - size_t detectBlendMask(osg::Node* node); + size_t detectBlendMask(const osg::Node* node) const; /* Updates the position of the accum root node for the given time, and * returns the wanted movement vector from the previous time. */ @@ -315,7 +315,7 @@ protected: */ virtual void addControllers(); - osg::Vec4f getEnchantmentColor(MWWorld::Ptr item); + osg::Vec4f getEnchantmentColor(const MWWorld::ConstPtr& item) const; void addGlow(osg::ref_ptr node, osg::Vec4f glowColor); @@ -327,7 +327,7 @@ public: Animation(const MWWorld::Ptr &ptr, osg::ref_ptr parentNode, Resource::ResourceSystem* resourceSystem); virtual ~Animation(); - MWWorld::Ptr getPtr(); + MWWorld::ConstPtr getPtr() const; /// Set active flag on the object skeleton, if one exists. /// @see SceneUtil::Skeleton::setActive @@ -349,11 +349,11 @@ public: */ void addEffect (const std::string& model, int effectId, bool loop = false, const std::string& bonename = "", std::string texture = ""); void removeEffect (int effectId); - void getLoopingEffects (std::vector& out); + void getLoopingEffects (std::vector& out) const; virtual void updatePtr(const MWWorld::Ptr &ptr); - bool hasAnimation(const std::string &anim); + bool hasAnimation(const std::string &anim) const; // Specifies the axis' to accumulate on. Non-accumulated axis will just // move visually, but not affect the actual movement. Each x/y/z value