From 0c598c5aee973bb9ff3fd988a0263436588f532f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 22 Feb 2015 12:20:46 +0300 Subject: Dont attack targets by click if pressed "stop attack key". --- src/gui/viewport.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/gui/viewport.cpp') diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index ec723f103..4592d5e69 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -413,6 +413,7 @@ bool Viewport::openContextMenu(const MouseEvent &event) bool Viewport::leftMouseAction() { + const bool stopAttack = inputManager.isActionActive(InputAction::STOP_ATTACK); // Interact with some being if (mHoverBeing) { @@ -440,11 +441,11 @@ bool Viewport::leftMouseAction() return true; } } - else if (type == ActorType::Monster || type == ActorType::Npc) + else if (!stopAttack && (type == ActorType::Monster || type == ActorType::Npc)) { - if (localPlayer->withinAttackRange(mHoverBeing) || + if ((localPlayer->withinAttackRange(mHoverBeing) || inputManager.isActionActive(static_cast( - InputAction::ATTACK))) + InputAction::ATTACK)))) { validateSpeed(); if (!mStatsReUpdated && localPlayer != mHoverBeing) @@ -474,7 +475,7 @@ bool Viewport::leftMouseAction() validateSpeed(); localPlayer->pickUp(mHoverItem); } - else if (inputManager.isActionActive(InputAction::STOP_ATTACK)) + else if (stopAttack) { const int mouseTileX = (mMouseX + mPixelViewX) / mMap->getTileWidth(); @@ -483,6 +484,7 @@ bool Viewport::leftMouseAction() inputManager.executeChatCommand(InputAction::PET_MOVE, strprintf("%d %d", mouseTileX, mouseTileY), nullptr); + return true; } // Just walk around else if (!inputManager.isActionActive(static_cast( -- cgit v1.2.3-70-g09d2