summaryrefslogtreecommitdiff
path: root/src/animatedsprite.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-07-30 15:19:45 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-07-30 15:19:45 +0000
commit7b599fad6cdbaa40f1cb496218dcd5546de7f520 (patch)
tree36222d32c9b56701be663dad80e06af47acd78d2 /src/animatedsprite.cpp
parentb280c89bbc8a3c12e45c3907166cc79e45fcf66d (diff)
downloadmana-7b599fad6cdbaa40f1cb496218dcd5546de7f520.tar.gz
mana-7b599fad6cdbaa40f1cb496218dcd5546de7f520.tar.bz2
mana-7b599fad6cdbaa40f1cb496218dcd5546de7f520.tar.xz
mana-7b599fad6cdbaa40f1cb496218dcd5546de7f520.zip
Unified the play methods.
Diffstat (limited to 'src/animatedsprite.cpp')
-rw-r--r--src/animatedsprite.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp
index 25525a69..9c82bf7a 100644
--- a/src/animatedsprite.cpp
+++ b/src/animatedsprite.cpp
@@ -228,7 +228,7 @@ AnimatedSprite::~AnimatedSprite()
}
void
-AnimatedSprite::play(const std::string& action)
+AnimatedSprite::play(const std::string& action, int time)
{
ActionIterator i = mActions.find(action);
@@ -245,18 +245,10 @@ AnimatedSprite::play(const std::string& action)
mLastTime = 0;
}
- mSpeed = 1.0f;
-}
-
-void
-AnimatedSprite::play(const std::string& action, int time)
-{
- play(action);
-
- if (mAction != NULL)
- {
- Animation *animation = mAction->getAnimation(mDirection);
- int animationLength = animation->getLength();
+ if (!mAction || !time)
+ mSpeed = 1.0f;
+ else {
+ int animationLength = mAction->getAnimation(mDirection)->getLength();
mSpeed = (float) animationLength / time;
}
}