aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/draci/animation.cpp12
-rw-r--r--engines/draci/animation.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/engines/draci/animation.cpp b/engines/draci/animation.cpp
index c074deb867..94c12d1c51 100644
--- a/engines/draci/animation.cpp
+++ b/engines/draci/animation.cpp
@@ -98,11 +98,23 @@ void Animation::deleteAnimation(uint id) {
Common::List<AnimObj>::iterator it = getAnimation(id);
+ for(uint i = 0; i < it->_frames.size(); ++i) {
+ delete it->_frames[i];
+ }
+
_animObjects.erase(it);
}
void Animation::deleteAll() {
+ Common::List<AnimObj>::iterator it;
+
+ for (it = _animObjects.begin(); it != _animObjects.end(); ++it) {
+ for(uint i = 0; i < it->_frames.size(); ++i) {
+ delete it->_frames[i];
+ }
+ }
+
_animObjects.clear();
}
diff --git a/engines/draci/animation.h b/engines/draci/animation.h
index 8f4cc8e324..c654155a03 100644
--- a/engines/draci/animation.h
+++ b/engines/draci/animation.h
@@ -45,6 +45,7 @@ class Animation {
public:
Animation(DraciEngine *vm) : _vm(vm) {};
+ ~Animation() { deleteAll(); }
void addAnimation(uint id, uint z = 0);
void addFrame(uint id, Drawable *frame);