From 84af69cdf6e91c342090d9c8c9f3c3aaf008043f Mon Sep 17 00:00:00 2001 From: whiterandrek Date: Tue, 12 Jun 2018 20:05:05 +0300 Subject: PINK: move same code to startInventory function --- engines/pink/objects/actors/lead_actor.cpp | 26 +++++++++++++++----------- engines/pink/objects/actors/lead_actor.h | 2 ++ 2 files changed, 17 insertions(+), 11 deletions(-) (limited to 'engines') diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp index 2891682fca..8f48df52e0 100644 --- a/engines/pink/objects/actors/lead_actor.cpp +++ b/engines/pink/objects/actors/lead_actor.cpp @@ -103,14 +103,11 @@ void LeadActor::start(bool isHandler) { InventoryMgr *mgr = getInventoryMgr(); switch (_state) { case kInventory: - mgr->start(0); - _page->pause(true); + startInventory(1); break; case kPDA: - if (_stateBeforePDA == kInventory) { - mgr->start(0); - _page->pause(true); - } + if (_stateBeforePDA == kInventory) + startInventory(1); loadPDA(_page->getGame()->getPdaMgr().getSavedPageName()); break; default: @@ -275,11 +272,7 @@ void LeadActor::onClick() { _recipient = nullptr; _nextState = kReady; } - if (getInventoryMgr()->start(1)) { - _stateCopy = _state; - _state = kInventory; - _page->pause(true); - } + startInventory(0); } } @@ -387,6 +380,17 @@ Actor *LeadActor::getActorByPoint(const Common::Point point) { return _page->getGame()->getDirector()->getActorByPoint(point); } +void LeadActor::startInventory(bool fromSave) { + getInventoryMgr()->start(fromSave); + if (!fromSave) { + _isHaveItem = false; + _stateCopy = _state; + _state = kInventory; + forceUpdateCursor(); + } + _page->pause(true); +} + void ParlSqPink::toConsole() { debug("ParlSqPink: _name = %s", _name.c_str()); for (uint i = 0; i < _actions.size(); ++i) { diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h index 22d783ede5..c4c0748e70 100644 --- a/engines/pink/objects/actors/lead_actor.h +++ b/engines/pink/objects/actors/lead_actor.h @@ -100,6 +100,8 @@ protected: virtual WalkLocation *getWalkDestination(); + void startInventory(bool fromSave); + Actor *_recipient; CursorMgr *_cursorMgr; -- cgit v1.2.3