GRIM: Deactivate the animations of an AnimManager when deleting it.

This commit is contained in:
Giulio Camuffo 2011-12-14 17:49:58 +01:00
parent 3c4999dbc6
commit eb3eb1170a
2 changed files with 11 additions and 0 deletions

View File

@ -20,6 +20,8 @@
*
*/
#include "common/foreach.h"
#include "engines/grim/animation.h"
#include "engines/grim/resource.h"
#include "engines/grim/model.h"
@ -203,6 +205,14 @@ AnimManager::AnimManager() {
}
AnimManager::~AnimManager() {
foreach (const AnimationEntry &entry, _activeAnims) {
Animation *anim = entry._anim;
// Don't call deactivate() here so we don't mess with the list we're using.
anim->_manager = NULL;
anim->_active = false;
}
}
void AnimManager::addAnimation(Animation *anim, int priority1, int priority2) {
// Keep the list of animations sorted by priorities in descending order. Because

View File

@ -79,6 +79,7 @@ private:
class AnimManager {
public:
AnimManager();
~AnimManager();
void addAnimation(Animation *anim, int pr1, int pr2);
void removeAnimation(Animation *anim);