diff --git a/drape_frontend/animation/animation.hpp b/drape_frontend/animation/animation.hpp index 8338f7688c..57c96764df 100644 --- a/drape_frontend/animation/animation.hpp +++ b/drape_frontend/animation/animation.hpp @@ -113,7 +113,7 @@ public: virtual void Interrupt() { if (m_onInterruptAction != nullptr) m_onInterruptAction(this); } virtual Type GetType() const = 0; - virtual string const & GetCustomType() const { return ""; } + virtual string GetCustomType() const { return string(); } virtual TAnimObjects const & GetObjects() const = 0; virtual bool HasObject(TObject object) const = 0; diff --git a/drape_frontend/animation/sequence_animation.cpp b/drape_frontend/animation/sequence_animation.cpp index 3185e5bcfb..13ed1ad7a1 100644 --- a/drape_frontend/animation/sequence_animation.cpp +++ b/drape_frontend/animation/sequence_animation.cpp @@ -12,7 +12,7 @@ SequenceAnimation::SequenceAnimation() { } -string const & SequenceAnimation::GetCustomType() const +string SequenceAnimation::GetCustomType() const { return m_customType; } diff --git a/drape_frontend/animation/sequence_animation.hpp b/drape_frontend/animation/sequence_animation.hpp index 9e58d573d5..0cffac5c15 100644 --- a/drape_frontend/animation/sequence_animation.hpp +++ b/drape_frontend/animation/sequence_animation.hpp @@ -20,7 +20,7 @@ public: bool HasProperty(TObject object, TProperty property) const override; bool HasTargetProperty(TObject object, TProperty property) const override; - string const & GetCustomType() const override; + string GetCustomType() const override; void SetCustomType(string const & type); void SetMaxDuration(double maxDuration) override; diff --git a/drape_frontend/animation_system.hpp b/drape_frontend/animation_system.hpp index ce4c034d91..7a23337e1a 100644 --- a/drape_frontend/animation_system.hpp +++ b/drape_frontend/animation_system.hpp @@ -38,31 +38,15 @@ public: void FinishAnimations(Animation::Type type, string const & customType, bool rewind, bool finishAll); void FinishObjectAnimations(Animation::TObject object, bool rewind, bool finishAll); - template T const * FindAnimation(Animation::Type type) const + template T const * FindAnimation(Animation::Type type, char const * customType = nullptr) const { for (auto & pList : m_animationChain) { auto & lst = *pList; for (auto const & anim : lst) { - if (anim->GetType() == type) - { - ASSERT(dynamic_cast(anim.get()) != nullptr, ()); - return static_cast(anim.get()); - } - } - } - return nullptr; - } - - template T const * FindAnimation(Animation::Type type, string const & customType) const - { - for (auto & pList : m_animationChain) - { - auto & lst = *pList; - for (auto const & anim : lst) - { - if (anim->GetType() == type && anim->GetCustomType() == customType) + if ((anim->GetType() == type) && + (customType == nullptr || strcmp(anim->GetCustomType().c_str(), customType) == 0)) { ASSERT(dynamic_cast(anim.get()) != nullptr, ()); return static_cast(anim.get()); diff --git a/drape_frontend/user_event_stream.cpp b/drape_frontend/user_event_stream.cpp index 4c17f3745b..0a7cdc687f 100644 --- a/drape_frontend/user_event_stream.cpp +++ b/drape_frontend/user_event_stream.cpp @@ -477,7 +477,7 @@ bool UserEventStream::InterruptFollowAnimations(bool force) Animation const * followAnim = m_animationSystem.FindAnimation(Animation::MapFollow); if (followAnim == nullptr) - followAnim = m_animationSystem.FindAnimation(Animation::Sequence, kPrettyFollowAnim); + followAnim = m_animationSystem.FindAnimation(Animation::Sequence, kPrettyFollowAnim.c_str()); if (followAnim != nullptr) {