diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index f7e50950cec04f07502ccddca9fa007a48ec44a0..c4d2800606761111527d49f0c31289d658a1b8e9 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -3974,7 +3974,7 @@ bool LLAgent::teleportCore(bool is_local) // Stop all animation before actual teleporting if (isAgentAvatarValid()) { - for ( LLVOAvatar::AnimIterator anim_it= gAgentAvatarp->mPlayingAnimations.begin(); + for (auto anim_it = gAgentAvatarp->mPlayingAnimations.begin(); anim_it != gAgentAvatarp->mPlayingAnimations.end(); ++anim_it) { @@ -4548,13 +4548,10 @@ void LLAgent::stopCurrentAnimations() { std::vector<LLUUID> anim_ids; - for ( LLVOAvatar::AnimIterator anim_it = - gAgentAvatarp->mPlayingAnimations.begin(); - anim_it != gAgentAvatarp->mPlayingAnimations.end(); - anim_it++) + for (const auto& anim_pair : gAgentAvatarp->mPlayingAnimations) { - if ((anim_it->first == ANIM_AGENT_DO_NOT_DISTURB)|| - (anim_it->first == ANIM_AGENT_SIT_GROUND_CONSTRAINED)) + if ((anim_pair.first == ANIM_AGENT_DO_NOT_DISTURB)|| + (anim_pair.first == ANIM_AGENT_SIT_GROUND_CONSTRAINED)) { // don't cancel a ground-sit anim, as viewers // use this animation's status in @@ -4564,9 +4561,9 @@ void LLAgent::stopCurrentAnimations() else { // stop this animation locally - gAgentAvatarp->stopMotion(anim_it->first, TRUE); + gAgentAvatarp->stopMotion(anim_pair.first, TRUE); // ...and tell the server to tell everyone. - anim_ids.push_back(anim_it->first); + anim_ids.push_back(anim_pair.first); } } diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index c1e322ddda27b3f4d5e8dedf59c0bda40d34f42d..23733956d313827caa0e7eb1561cb15e92c43ffc 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -569,14 +569,14 @@ void LLControlAvatar::updateAnimations() // Rebuild mSignaledAnimations from the associated volumes. auto& signaled_anim_map = LLObjectSignaledAnimationMap::instance().getMap(); - std::map<LLUUID, S32> anims; + anim_map_t anims; for (LLVOVolume* volp : volumes) { //LL_INFOS("AnimatedObjects") << "updating anim for vol " << volp->getID() << " root " << mRootVolp->getID() << LL_ENDL; signaled_animation_map_t& signaled_animations = signaled_anim_map[volp->getID()]; for (const auto& anim_pair : signaled_animations) { - std::map<LLUUID,S32>::iterator found_anim_it = anims.find(anim_pair.first); + auto found_anim_it = anims.find(anim_pair.first); if (found_anim_it != anims.end()) { // Animation already present, use the larger sequence id diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h index 3afbf323f0f9d2444b808833a3546042afcc7465..13c209fe6ce64961d1e733f9d30658447084cd20 100644 --- a/indra/newview/llcontrolavatar.h +++ b/indra/newview/llcontrolavatar.h @@ -101,7 +101,7 @@ class LLControlAvatar final : static boost::signals2::connection sRegionChangedSlot; }; -typedef std::map<LLUUID, S32> signaled_animation_map_t; +typedef absl::flat_hash_map<LLUUID, S32> signaled_animation_map_t; typedef std::map<LLUUID, signaled_animation_map_t> object_signaled_animation_map_t; // Stores information about previously requested animations, by object id. diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 56583039f5d78663bf0f0f2a805f6ce273023a49..197f597d175b57dd1db71412254eec01d027317d 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -830,7 +830,7 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture) { // look in signaled animations (simulator's view of what is // currently playing. - LLVOAvatar::AnimIterator play_it = gAgentAvatarp->mSignaledAnimations.find(*gest_it); + auto play_it = gAgentAvatarp->mSignaledAnimations.find(*gest_it); if (play_it != gAgentAvatarp->mSignaledAnimations.end()) { ++gest_it; @@ -849,7 +849,7 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture) gest_it != gesture->mRequestedAnimIDs.end(); ) { - LLVOAvatar::AnimIterator play_it = gAgentAvatarp->mSignaledAnimations.find(*gest_it); + auto play_it = gAgentAvatarp->mSignaledAnimations.find(*gest_it); if (play_it != gAgentAvatarp->mSignaledAnimations.end()) { // Hooray, this animation has started playing! diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5975e369c1f5175664611e2c42bef0faf61aa773..5f279706d3435ae5fff4604e9a512465160caf5d 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5917,17 +5917,15 @@ void LLVOAvatar::processAnimationStateChanges() // clear all current animations for (auto anim_it = mPlayingAnimations.begin(); anim_it != mPlayingAnimations.end();) { - AnimIterator found_anim = mSignaledAnimations.find(anim_it->first); + auto copy_anim_it = anim_it++; + + auto found_anim = mSignaledAnimations.find(copy_anim_it->first); // playing, but not signaled, so stop if (found_anim == mSignaledAnimations.end()) { - processSingleAnimationStateChange(anim_it->first, FALSE); - anim_it = mPlayingAnimations.erase(anim_it); - } - else - { - ++anim_it; + processSingleAnimationStateChange(copy_anim_it->first, FALSE); + mPlayingAnimations.erase(copy_anim_it); } } @@ -5942,7 +5940,7 @@ void LLVOAvatar::processAnimationStateChanges() { for (auto anim_it = mSignaledAnimations.begin(); anim_it != mSignaledAnimations.end();) { - AnimIterator found_anim = mPlayingAnimations.find(anim_it->first); + auto found_anim = mPlayingAnimations.find(anim_it->first); // signaled but not playing, or different sequence id, start motion if (found_anim == mPlayingAnimations.end() || found_anim->second != anim_it->second) @@ -5966,13 +5964,11 @@ void LLVOAvatar::processAnimationStateChanges() for (source_it = mAnimationSources.begin(); source_it != mAnimationSources.end();) { + auto copy_source_it = source_it++; + if (mSignaledAnimations.find(source_it->second) == mSignaledAnimations.end()) { - mAnimationSources.erase(source_it++); - } - else - { - ++source_it; + mAnimationSources.erase(copy_source_it); } } } @@ -10920,12 +10916,10 @@ void LLVOAvatar::setOverallAppearanceJellyDoll() // stop current animations { - for ( LLVOAvatar::AnimIterator anim_it= mPlayingAnimations.begin(); - anim_it != mPlayingAnimations.end(); - ++anim_it) + for (const auto& anim_pair : mPlayingAnimations) { { - stopMotion(anim_it->first, TRUE); + stopMotion(anim_pair.first, TRUE); } } } diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 33a3c2180ca148a9caa6210edea23765c1d5e338..67aca6882ee6770a63578cd4b2a71ecc8b32b414 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -908,9 +908,10 @@ class LLVOAvatar : // Animation state data //-------------------------------------------------------------------- public: - typedef std::map<LLUUID, S32>::iterator AnimIterator; - std::map<LLUUID, S32> mSignaledAnimations; // requested state of Animation name/value - std::map<LLUUID, S32> mPlayingAnimations; // current state of Animation name/value + + using anim_map_t = absl::flat_hash_map<LLUUID, S32>; + anim_map_t mSignaledAnimations; // requested state of Animation name/value + anim_map_t mPlayingAnimations; // current state of Animation name/value typedef std::multimap<LLUUID, LLUUID> AnimationSourceMap; typedef AnimationSourceMap::iterator AnimSourceIterator;