aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2014-04-06 22:28:14 -0400
committerPaul Gilbert2014-04-06 22:28:14 -0400
commit54bcb822fbd4e5d573ae5cd00ce3b813fbc7faa6 (patch)
treec18098a8fe9569510adc784b16233d11728df8d8
parentb435c76b2578ad0650606ba6ad59f56eeb94ee01 (diff)
downloadscummvm-rg350-54bcb822fbd4e5d573ae5cd00ce3b813fbc7faa6.tar.gz
scummvm-rg350-54bcb822fbd4e5d573ae5cd00ce3b813fbc7faa6.tar.bz2
scummvm-rg350-54bcb822fbd4e5d573ae5cd00ce3b813fbc7faa6.zip
MADS: Properly free scene-specific sprite sets when leaving scene
-rw-r--r--engines/mads/animation.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp
index f581bf42ce..769bd39aef 100644
--- a/engines/mads/animation.cpp
+++ b/engines/mads/animation.cpp
@@ -144,7 +144,15 @@ Animation::Animation(MADSEngine *vm, Scene *scene) : _vm(vm), _scene(scene) {
}
Animation::~Animation() {
- delete _font;
+ Scene &scene = _vm->_game->_scene;
+
+ if (_header._manualFlag)
+ scene._sprites.remove(_spriteListIndexes[_header._spritesIndex]);
+
+ for (uint idx = 0; idx < _header._spriteSetsCount; ++idx) {
+ if (!_header._manualFlag || _header._spritesIndex != idx)
+ scene._sprites.remove(_spriteListIndexes[idx]);
+ }
}
void Animation::free() {