diff options
author | Filippos Karapetis | 2014-12-24 23:18:01 +0200 |
---|---|---|
committer | Filippos Karapetis | 2014-12-24 23:18:01 +0200 |
commit | 75d78c71cc2190ae4afa655d27cdbc35a748f901 (patch) | |
tree | 87af917cae5afdab97f668f4a3e618bbdb60d9e6 | |
parent | 5f8418394b925adfc62ee6d180515157190a8cd9 (diff) | |
download | scummvm-rg350-75d78c71cc2190ae4afa655d27cdbc35a748f901.tar.gz scummvm-rg350-75d78c71cc2190ae4afa655d27cdbc35a748f901.tar.bz2 scummvm-rg350-75d78c71cc2190ae4afa655d27cdbc35a748f901.zip |
ZVISION: Plug another memory leak. Some cleanup
-rw-r--r-- | engines/zvision/scripting/sidefx/animation_node.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/engines/zvision/scripting/sidefx/animation_node.cpp b/engines/zvision/scripting/sidefx/animation_node.cpp index bf3509f545..dec70e2642 100644 --- a/engines/zvision/scripting/sidefx/animation_node.cpp +++ b/engines/zvision/scripting/sidefx/animation_node.cpp @@ -44,7 +44,7 @@ AnimationNode::AnimationNode(ZVision *engine, uint32 controlKey, const Common::S Common::File *tmp = engine->getSearchManager()->openFile(fileName); if (tmp) { tmp->seek(176, SEEK_SET); - _frmDelay = tmp->readUint32LE() / 10; + _frmDelay = Common::Rational(tmp->readUint32LE(), 10).toInt(); delete tmp; } @@ -73,8 +73,10 @@ AnimationNode::~AnimationNode() { if (it != _playList.end()) { _engine->getScriptManager()->setStateValue((*it).slot, 2); - if ((*it)._scaled) + if ((*it)._scaled) { + (*it)._scaled->free(); delete(*it)._scaled; + } } _playList.clear(); @@ -109,8 +111,10 @@ bool AnimationNode::process(uint32 deltaTimeInMillis) { if (nod->loop == 0) { if (nod->slot >= 0) _engine->getScriptManager()->setStateValue(nod->slot, 2); - if (nod->_scaled) + if (nod->_scaled) { + nod->_scaled->free(); delete nod->_scaled; + } _playList.erase(it); return _DisposeAfterUse; } @@ -142,6 +146,7 @@ bool AnimationNode::process(uint32 deltaTimeInMillis) { if (frame->w > dstw || frame->h > dsth || (frame->w == dstw / 2 && frame->h == dsth / 2)) { if (nod->_scaled) if (nod->_scaled->w != dstw || nod->_scaled->h != dsth) { + nod->_scaled->free(); delete nod->_scaled; nod->_scaled = NULL; } @@ -197,8 +202,10 @@ bool AnimationNode::stop() { PlayNodes::iterator it = _playList.begin(); if (it != _playList.end()) { _engine->getScriptManager()->setStateValue((*it).slot, 2); - if ((*it)._scaled) + if ((*it)._scaled) { + (*it)._scaled->free(); delete(*it)._scaled; + } } _playList.clear(); |