From 54bcb822fbd4e5d573ae5cd00ce3b813fbc7faa6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 6 Apr 2014 22:28:14 -0400 Subject: MADS: Properly free scene-specific sprite sets when leaving scene --- engines/mads/animation.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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() { -- cgit v1.2.3