diff options
Diffstat (limited to 'indra/llcharacter/llcharacter.cpp')
-rw-r--r-- | indra/llcharacter/llcharacter.cpp | 53 |
1 files changed, 18 insertions, 35 deletions
diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index f2aa55a32c..ecbcdb3bf5 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -38,8 +38,8 @@ LLStringTable LLCharacter::sVisualParamNames(1024); -std::vector< LLCharacter* > LLCharacter::sInstances; -BOOL LLCharacter::sAllowInstancesChange = TRUE ; +std::list< LLCharacter* > LLCharacter::sInstances; +bool LLCharacter::sAllowInstancesChange = true ; //----------------------------------------------------------------------------- // LLCharacter() @@ -53,7 +53,6 @@ LLCharacter::LLCharacter() mSkeletonSerialNum( 0 ) { llassert_always(sAllowInstancesChange) ; - sInstances.push_back(this); mMotionController.setCharacter( this ); mPauseRequest = new LLPauseRequestHandle(); @@ -66,28 +65,12 @@ LLCharacter::LLCharacter() //----------------------------------------------------------------------------- LLCharacter::~LLCharacter() { - for (LLVisualParam *param = getFirstVisualParam(); - param; - param = getNextVisualParam()) + for (const auto& it : mVisualParamIndexMap) { - delete param; + delete it.second; } - U32 i ; - U32 size = sInstances.size() ; - for(i = 0 ; i < size ; i++) - { - if(sInstances[i] == this) - { - break ; - } - } - - llassert_always(i < size) ; - llassert_always(sAllowInstancesChange) ; - sInstances[i] = sInstances[size - 1] ; - sInstances.pop_back() ; } @@ -114,7 +97,7 @@ LLJoint *LLCharacter::getJoint( const std::string &name ) //----------------------------------------------------------------------------- // registerMotion() //----------------------------------------------------------------------------- -BOOL LLCharacter::registerMotion( const LLUUID& id, LLMotionConstructor create ) +bool LLCharacter::registerMotion( const LLUUID& id, LLMotionConstructor create ) { return mMotionController.registerMotion(id, create); } @@ -147,7 +130,7 @@ LLMotion* LLCharacter::createMotion( const LLUUID &id ) //----------------------------------------------------------------------------- // startMotion() //----------------------------------------------------------------------------- -BOOL LLCharacter::startMotion(const LLUUID &id, F32 start_offset) +bool LLCharacter::startMotion(const LLUUID &id, F32 start_offset) { return mMotionController.startMotion(id, start_offset); } @@ -156,7 +139,7 @@ BOOL LLCharacter::startMotion(const LLUUID &id, F32 start_offset) //----------------------------------------------------------------------------- // stopMotion() //----------------------------------------------------------------------------- -BOOL LLCharacter::stopMotion(const LLUUID& id, BOOL stop_immediate) +bool LLCharacter::stopMotion(const LLUUID& id, bool stop_immediate) { return mMotionController.stopMotionLocally(id, stop_immediate); } @@ -164,7 +147,7 @@ BOOL LLCharacter::stopMotion(const LLUUID& id, BOOL stop_immediate) //----------------------------------------------------------------------------- // isMotionActive() //----------------------------------------------------------------------------- -BOOL LLCharacter::isMotionActive(const LLUUID& id) +bool LLCharacter::isMotionActive(const LLUUID& id) { LLMotion *motionp = mMotionController.findMotion(id); if (motionp) @@ -172,7 +155,7 @@ BOOL LLCharacter::isMotionActive(const LLUUID& id) return mMotionController.isMotionActive(motionp); } - return FALSE; + return false; } @@ -279,22 +262,22 @@ void LLCharacter::removeAnimationData(std::string name) //----------------------------------------------------------------------------- // setVisualParamWeight() //----------------------------------------------------------------------------- -BOOL LLCharacter::setVisualParamWeight(const LLVisualParam* which_param, F32 weight) +bool LLCharacter::setVisualParamWeight(const LLVisualParam* which_param, F32 weight) { S32 index = which_param->getID(); visual_param_index_map_t::iterator index_iter = mVisualParamIndexMap.find(index); if (index_iter != mVisualParamIndexMap.end()) { index_iter->second->setWeight(weight); - return TRUE; + return true; } - return FALSE; + return false; } //----------------------------------------------------------------------------- // setVisualParamWeight() //----------------------------------------------------------------------------- -BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight) +bool LLCharacter::setVisualParamWeight(const char* param_name, F32 weight) { std::string tname(param_name); LLStringUtil::toLower(tname); @@ -303,25 +286,25 @@ BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight) if (name_iter != mVisualParamNameMap.end()) { name_iter->second->setWeight(weight); - return TRUE; + return true; } LL_WARNS() << "LLCharacter::setVisualParamWeight() Invalid visual parameter: " << param_name << LL_ENDL; - return FALSE; + return false; } //----------------------------------------------------------------------------- // setVisualParamWeight() //----------------------------------------------------------------------------- -BOOL LLCharacter::setVisualParamWeight(S32 index, F32 weight) +bool LLCharacter::setVisualParamWeight(S32 index, F32 weight) { visual_param_index_map_t::iterator index_iter = mVisualParamIndexMap.find(index); if (index_iter != mVisualParamIndexMap.end()) { index_iter->second->setWeight(weight); - return TRUE; + return true; } LL_WARNS() << "LLCharacter::setVisualParamWeight() Invalid visual parameter index: " << index << LL_ENDL; - return FALSE; + return false; } //----------------------------------------------------------------------------- |