summaryrefslogtreecommitdiff
path: root/src/gui/viewport.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/viewport.cpp')
-rw-r--r--src/gui/viewport.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 855a05e4..fd6bc6a3 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -468,12 +468,17 @@ void Viewport::mousePressed(gcn::MouseEvent &event)
// Ignore it if its dead
if (mHoverBeing->isAlive())
{
- if (local_player->withinAttackRange(mHoverBeing) ||
- keyboard.isKeyActive(keyboard.KEY_ATTACK))
+ if (local_player->withinRange(mHoverBeing,
+ local_player->getAttackRange())
+ || keyboard.isKeyActive(keyboard.KEY_ATTACK))
+ {
local_player->attack(mHoverBeing,
!keyboard.isKeyActive(keyboard.KEY_TARGET));
+ }
else
+ {
local_player->setGotoTarget(mHoverBeing);
+ }
}
}
// Picks up a item if we clicked on one