summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-02-22 12:20:46 +0300
committerAndrei Karas <akaras@inbox.ru>2015-02-22 12:20:46 +0300
commit0c598c5aee973bb9ff3fd988a0263436588f532f (patch)
tree4d83b5fb08353b62aefa03e5741572a872584366
parent0a0ac45efa1305a8b40fc2b61f420b13c5e9fe9b (diff)
downloadmv-0c598c5aee973bb9ff3fd988a0263436588f532f.tar.gz
mv-0c598c5aee973bb9ff3fd988a0263436588f532f.tar.bz2
mv-0c598c5aee973bb9ff3fd988a0263436588f532f.tar.xz
mv-0c598c5aee973bb9ff3fd988a0263436588f532f.zip
Dont attack targets by click if pressed "stop attack key".
-rw-r--r--src/gui/viewport.cpp10
1 files changed, 6 insertions, 4 deletions
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<int>(
- 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<int>(