Review fixes.

This commit is contained in:
Daria Volvenkova 2016-06-07 12:40:37 +03:00 committed by Vladimir Byko-Ianko
parent 6911dc38b7
commit c50413ea55
5 changed files with 7 additions and 23 deletions

View file

@ -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;

View file

@ -12,7 +12,7 @@ SequenceAnimation::SequenceAnimation()
{
}
string const & SequenceAnimation::GetCustomType() const
string SequenceAnimation::GetCustomType() const
{
return m_customType;
}

View file

@ -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;

View file

@ -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<typename T> T const * FindAnimation(Animation::Type type) const
template<typename T> 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<T const *>(anim.get()) != nullptr, ());
return static_cast<T const *>(anim.get());
}
}
}
return nullptr;
}
template<typename T> 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<T const *>(anim.get()) != nullptr, ());
return static_cast<T const *>(anim.get());

View file

@ -477,7 +477,7 @@ bool UserEventStream::InterruptFollowAnimations(bool force)
Animation const * followAnim = m_animationSystem.FindAnimation<MapFollowAnimation>(Animation::MapFollow);
if (followAnim == nullptr)
followAnim = m_animationSystem.FindAnimation<SequenceAnimation>(Animation::Sequence, kPrettyFollowAnim);
followAnim = m_animationSystem.FindAnimation<SequenceAnimation>(Animation::Sequence, kPrettyFollowAnim.c_str());
if (followAnim != nullptr)
{