objects.erase(&obj);
}
+void AnimationPlayer::stop(AnimatedObject &obj, const Animation &anim)
+{
+ ObjectMap::iterator i = objects.find(&obj);
+ if(i==objects.end())
+ return;
+
+ for(AnimationList::iterator j=i->second.animations.begin(); j!=i->second.animations.end(); ++j)
+ if(&j->animation==&anim)
+ {
+ i->second.animations.erase(j);
+ break;
+ }
+
+ if(i->second.animations.empty())
+ objects.erase(i);
+}
+
void AnimationPlayer::tick(const Time::TimeDelta &dt)
{
for(ObjectMap::iterator i=objects.begin(); i!=objects.end(); )
/// Returns the number of animations currently affecting an object.
unsigned get_n_active_animations(const AnimatedObject &) const;
- /// Stops any animations affecting an object.
+ /// Stops all animations affecting an object.
void stop(AnimatedObject &);
+ /// Stops a single animation affecting an object.
+ void stop(AnimatedObject &, const Animation &);
+
/** Advances all playing animations. Should be called in a regular manner,
preferably just before rendering. */
void tick(const Time::TimeDelta &);