diff options
author | uruk | 2014-05-18 11:37:06 +0200 |
---|---|---|
committer | uruk | 2014-05-18 11:37:06 +0200 |
commit | 938a2e66c214b9db4de563061639c74265e70fdb (patch) | |
tree | d113003c80dafd0bbca2bfe0ce7c851b520977b2 /engines | |
parent | 3e97ade38842b29e01692c00c452c30afe4ea67f (diff) | |
download | scummvm-rg350-938a2e66c214b9db4de563061639c74265e70fdb.tar.gz scummvm-rg350-938a2e66c214b9db4de563061639c74265e70fdb.tar.bz2 scummvm-rg350-938a2e66c214b9db4de563061639c74265e70fdb.zip |
CGE2: Implement Spare::dispose(), add Spare::update().
Diffstat (limited to 'engines')
-rw-r--r-- | engines/cge2/spare.cpp | 20 | ||||
-rw-r--r-- | engines/cge2/spare.h | 1 |
2 files changed, 15 insertions, 6 deletions
diff --git a/engines/cge2/spare.cpp b/engines/cge2/spare.cpp index aff61b3f28..4c66e96285 100644 --- a/engines/cge2/spare.cpp +++ b/engines/cge2/spare.cpp @@ -58,16 +58,24 @@ void Spare::store(Sprite *spr) { _container.insert_at(_container.size(), spr); } -void Spare::dispose(Sprite *spr) { - warning("STUB: Spare::Dispose()"); +void Spare::update(Sprite *spr) { + Sprite *sp = locate(spr->_ref); + if (sp == nullptr) + store(spr); +} +void Spare::dispose(Sprite *spr) { if (spr) { _vm->_vga->_showQ->remove(spr); - - for (int i = 0; i < _container.size(); i++) { - if (spr == _container[i]) { - _container.remove_at(i); + update(spr->contract()); + if (spr->_ref / 10 != 14) { // IIRC if it's == 14, it's the sprite of a Hero. No idea yet why it shouldn't be deleted then. + for (int i = 0; i < _container.size(); i++) { + if (spr == _container[i]) { + _container.remove_at(i); + } } + + delete spr; } } } diff --git a/engines/cge2/spare.h b/engines/cge2/spare.h index 54683b9c65..6e8f8c5987 100644 --- a/engines/cge2/spare.h +++ b/engines/cge2/spare.h @@ -41,6 +41,7 @@ public: void store(Sprite *spr); Sprite *locate(int ref); void takeCave(int ref); // Note that it takes the ref of the sprite now, not the number of the scene, like the original! + void update(Sprite *spr); void dispose(Sprite *spr); void dispose(int ref); void dispose(); |