diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 7f6d7f1128..587c49704c 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -476,9 +476,7 @@ void CharacterController::playGroup(const std::string &groupname, int mode, int count = std::max(count, 1); if(mode != 0 || mAnimQueue.size() == 0) { - if(mAnimQueue.size() > 0) - mAnimation->disable(mAnimQueue.front().first); - mAnimQueue.clear(); + clearAnimQueue(); mAnimQueue.push_back(std::make_pair(groupname, count-1)); mCharState = CharState_SpecialIdle; @@ -500,6 +498,14 @@ void CharacterController::skipAnim() } +void CharacterController::clearAnimQueue() +{ + if(mAnimQueue.size() > 0) + mAnimation->disable(mAnimQueue.front().first); + mAnimQueue.clear(); +} + + void CharacterController::setState(CharacterState state) { if(mCharState == state) @@ -513,9 +519,7 @@ void CharacterController::forceStateUpdate() { if(!mAnimation) return; - if(mAnimQueue.size() > 0) - mAnimation->disable(mAnimQueue.front().first); - mAnimQueue.clear(); + clearAnimQueue(); std::string group; Priority prio; diff --git a/apps/openmw/mwmechanics/character.hpp b/apps/openmw/mwmechanics/character.hpp index 4c5ad03f5e..c711729927 100644 --- a/apps/openmw/mwmechanics/character.hpp +++ b/apps/openmw/mwmechanics/character.hpp @@ -111,6 +111,8 @@ class CharacterController static void getWeaponGroup(WeaponType weaptype, std::string &group); + void clearAnimQueue(); + public: CharacterController(const MWWorld::Ptr &ptr, MWRender::Animation *anim, CharacterState state); virtual ~CharacterController();