summaryrefslogtreecommitdiff
path: root/src/animatedsprite.cpp
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-18 19:00:38 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-18 19:00:38 +0000
commit54ac35bc5a1484757efeae9b342469b9a00fe2a2 (patch)
tree73917e6a43f0a90a9f25aaaad24c214c37bf52c4 /src/animatedsprite.cpp
parent03b2efa5973db10c3e6366aa0bd2990eee60d8b9 (diff)
downloadmana-54ac35bc5a1484757efeae9b342469b9a00fe2a2.tar.gz
mana-54ac35bc5a1484757efeae9b342469b9a00fe2a2.tar.bz2
mana-54ac35bc5a1484757efeae9b342469b9a00fe2a2.tar.xz
mana-54ac35bc5a1484757efeae9b342469b9a00fe2a2.zip
Removed player looks from generic beings. Prevented client termination on missing sprites. Merged weapon-type and attack-type fields for items.
Diffstat (limited to 'src/animatedsprite.cpp')
-rw-r--r--src/animatedsprite.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp
index c1e89ff0..466779fd 100644
--- a/src/animatedsprite.cpp
+++ b/src/animatedsprite.cpp
@@ -54,20 +54,14 @@ AnimatedSprite::AnimatedSprite(SpriteDef *sprite):
play(ACTION_STAND);
}
-AnimatedSprite::AnimatedSprite(const std::string& filename, int variant):
- mDirection(DIRECTION_DOWN),
- mLastTime(0),
- mFrameIndex(0),
- mFrameTime(0),
- mAnimation(0),
- mFrame(0)
+AnimatedSprite *AnimatedSprite::load(const std::string& filename, int variant)
{
ResourceManager *resman = ResourceManager::getInstance();
- mSprite = resman->getSprite(filename, variant);
- assert(mSprite);
-
- // Play the stand animation by default
- play(ACTION_STAND);
+ SpriteDef *s = resman->getSprite(filename, variant);
+ if (!s) return NULL;
+ AnimatedSprite *as = new AnimatedSprite(s);
+ s->decRef();
+ return as;
}
AnimatedSprite::~AnimatedSprite()