diff options
author | whiterandrek | 2018-04-27 11:27:45 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2018-06-28 23:51:32 +0200 |
commit | ec96a3b1e7c888fa4b3a2957854942d7fed3e766 (patch) | |
tree | d15ccc31f2026afed6915d6dc8febdd98cc109ab /engines/pink | |
parent | 2f43cbafa0da1266ab55e39b94a88af65c844ea0 (diff) | |
download | scummvm-rg350-ec96a3b1e7c888fa4b3a2957854942d7fed3e766.tar.gz scummvm-rg350-ec96a3b1e7c888fa4b3a2957854942d7fed3e766.tar.bz2 scummvm-rg350-ec96a3b1e7c888fa4b3a2957854942d7fed3e766.zip |
PINK: added check for item owner
Diffstat (limited to 'engines/pink')
-rw-r--r-- | engines/pink/objects/inventory.cpp | 14 | ||||
-rw-r--r-- | engines/pink/objects/pages/game_page.cpp | 9 |
2 files changed, 17 insertions, 6 deletions
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp index 2c4aa5966f..1b5ac2b378 100644 --- a/engines/pink/objects/inventory.cpp +++ b/engines/pink/objects/inventory.cpp @@ -178,12 +178,16 @@ void InventoryMgr::showNextItem(bool direction) { break; } } - index = (direction == kLeft) ? --index : ++index; - index %= _items.size(); - //add check for item owner - _itemActor->setAction(_items[index]->getName()); - _item = _items[index]; + int i = 0; + do { + index = (direction == kLeft) ? --index : ++index; + } while(_items[index % _items.size()]->getCurrentOwner() != _item->getCurrentOwner() && ++i < _items.size()); + + if (i != _items.size()) { + _item = _items[index % _items.size()]; + _itemActor->setAction(_item->getName()); + } } } // End of namespace Pink diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp index 6b029fbae3..47437a83a3 100644 --- a/engines/pink/objects/pages/game_page.cpp +++ b/engines/pink/objects/pages/game_page.cpp @@ -86,7 +86,7 @@ void GamePage::init(bool isLoadingSave) { _actors[i]->init(startNow); } - bool isHandler = 0; + bool isHandler = false; if (!isLoadingSave) { isHandler = initHandler(); } @@ -106,6 +106,7 @@ bool GamePage::initHandler() { void GamePage::loadManagers() { _isLoaded = true; + _cursorMgr = new CursorMgr(_module->getGame(), this); _walkMgr = new WalkMgr; _sequencer = new Sequencer(this); @@ -114,6 +115,7 @@ void GamePage::loadManagers() { if (_memFile != nullptr) { loadState(); + delete _memFile; _memFile = nullptr; } @@ -176,18 +178,23 @@ void GamePage::saveState() { void GamePage::unload() { _leadActor->setAction(_leadActor->findAction("Idle")); + saveState(); clear(); + _isLoaded = false; } void GamePage::clear() { Page::clear(); _variables.clear(1); + for (int i = 0; i < _handlers.size(); ++i) { delete _handlers[i]; } + _handlers.clear(); + delete _cursorMgr; _cursorMgr = nullptr; delete _sequencer; _sequencer = nullptr; delete _walkMgr; _walkMgr = nullptr; |