diff options
author | Denis Kasak | 2009-07-03 18:19:51 +0000 |
---|---|---|
committer | Denis Kasak | 2009-07-03 18:19:51 +0000 |
commit | 4465ecf1233726ce70a27b1d03ac49d222961ede (patch) | |
tree | cbddd3aab452eb7aef0e5f270c4696a7b9670b72 | |
parent | c651d1c2e252995cf3c6b84fe7b0a161437f5e99 (diff) | |
download | scummvm-rg350-4465ecf1233726ce70a27b1d03ac49d222961ede.tar.gz scummvm-rg350-4465ecf1233726ce70a27b1d03ac49d222961ede.tar.bz2 scummvm-rg350-4465ecf1233726ce70a27b1d03ac49d222961ede.zip |
Added deconstructor for Animation. Made Animation objects delete their frames when deleteAll() or deleteAnimation() are called.
svn-id: r42073
-rw-r--r-- | engines/draci/animation.cpp | 12 | ||||
-rw-r--r-- | engines/draci/animation.h | 1 |
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); |