summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-21 17:03:50 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-21 17:03:50 +0000
commit82d0b002e203ea1e8deb2f39ee6145155afde96f (patch)
treefd1b5c6fe6514a2fe2e0165650f67635a36d1e65 /src
parente27f3c797322be87a9519a5229fab51f5856233c (diff)
downloadmana-client-82d0b002e203ea1e8deb2f39ee6145155afde96f.tar.gz
mana-client-82d0b002e203ea1e8deb2f39ee6145155afde96f.tar.bz2
mana-client-82d0b002e203ea1e8deb2f39ee6145155afde96f.tar.xz
mana-client-82d0b002e203ea1e8deb2f39ee6145155afde96f.zip
Fixed double-free of sprite actions.
Diffstat (limited to 'src')
-rw-r--r--src/resources/action.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/resources/action.cpp b/src/resources/action.cpp
index 247455db..6b3c2f52 100644
--- a/src/resources/action.cpp
+++ b/src/resources/action.cpp
@@ -45,10 +45,11 @@ Action::getAnimation(int direction) const
{
Animations::const_iterator i = mAnimations.find(direction);
- // When the direction isn't defined, try the default
+ // When the given direction is not available, return the first one.
+ // (either DEFAULT, or more usually DOWN).
if (i == mAnimations.end())
{
- i = mAnimations.find(0);
+ i = mAnimations.begin();
}
return (i == mAnimations.end()) ? NULL : i->second;
@@ -57,11 +58,5 @@ Action::getAnimation(int direction) const
void
Action::setAnimation(int direction, Animation *animation)
{
- // Set first direction as default direction
- if (mAnimations.empty())
- {
- mAnimations[0] = animation;
- }
-
mAnimations[direction] = animation;
}