diff options
Diffstat (limited to 'engines/titanic/input_handler.cpp')
-rw-r--r-- | engines/titanic/input_handler.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp index e2d1bd7a32..cb1e3c9c68 100644 --- a/engines/titanic/input_handler.cpp +++ b/engines/titanic/input_handler.cpp @@ -32,7 +32,7 @@ namespace Titanic { CInputHandler::CInputHandler(CGameManager *owner) : _gameManager(owner), _inputTranslator(nullptr), _dragging(false), _buttonDown(false), _dragItem(nullptr), _lockCount(0), - _singleton(false) { + _abortMessage(false) { CScreenManager::_screenManagerPtr->_inputHandler = this; } @@ -59,7 +59,7 @@ void CInputHandler::decLockCount() { } _buttonDown = _inputTranslator->isMousePressed(); - _singleton = true; + _abortMessage = true; } } @@ -75,11 +75,11 @@ void CInputHandler::handleMessage(CMessage &msg, bool respectLock) { void CInputHandler::processMessage(CMessage *msg) { const CMouseMsg *mouseMsg = dynamic_cast<const CMouseMsg *>(msg); - _singleton = false; + _abortMessage = false; dispatchMessage(msg); - if (_singleton) { - _singleton = false; + if (_abortMessage) { + _abortMessage = false; } else if (mouseMsg) { // Keep the game state mouse position up to date if (_mousePos != mouseMsg->_mousePos) { @@ -100,8 +100,8 @@ void CInputHandler::processMessage(CMessage *msg) { CMouseDragMoveMsg moveMsg(_mousePos); moveMsg.execute(_dragItem); } - } else { - if (mouseMsg->isButtonUpMsg() && _dragItem) { + } else if (mouseMsg->isButtonUpMsg()) { + if (_dragItem) { // Mouse drag ended CGameObject *target = dragEnd(_mousePos, _dragItem); CMouseDragEndMsg endMsg(_mousePos, target); @@ -132,7 +132,7 @@ void CInputHandler::processMessage(CMessage *msg) { if (_dragItem) { CMouseDragMoveMsg moveMsg(_dragStartPos); - dispatchMessage(&moveMsg); + moveMsg.execute(_dragItem); } _dragging = true; @@ -155,7 +155,7 @@ CGameObject *CInputHandler::dragEnd(const Point &pt, CTreeItem *dragItem) { if (!view) return nullptr; - // Scan through the view items to find the item being dropped on + // Scan through the view items to find the element being dropped on CGameObject *target = nullptr; for (CTreeItem *treeItem = view->scan(view); treeItem; treeItem = treeItem->scan(view)) { CGameObject *gameObject = dynamic_cast<CGameObject *>(treeItem); |