From a76ce742cdf160909bfd72747e07adff687f0045 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sun, 10 May 2009 18:04:28 +0200 Subject: Stop attacking when walking away By setting mKeepAttacking to false when setting a destination. --- src/localplayer.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/localplayer.cpp') diff --git a/src/localplayer.cpp b/src/localplayer.cpp index c68be7a8..8a60a4b3 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -512,7 +512,7 @@ void LocalPlayer::walk(unsigned char dir) } } -Being* LocalPlayer::getTarget() const +Being *LocalPlayer::getTarget() const { return mTarget; } @@ -587,6 +587,8 @@ void LocalPlayer::setDestination(Uint16 x, Uint16 y) } mPickUpTarget = NULL; + mKeepAttacking = false; + Being::setDestination(x, y); } @@ -741,7 +743,7 @@ void LocalPlayer::attack(Being *target, bool keep) if (!target || target->getType() == Being::NPC) return; - if ((mTarget != target) || !mTarget) + if (mTarget != target || !mTarget) { mLastTarget = -1; setTarget(target); @@ -751,7 +753,8 @@ void LocalPlayer::attack(Being *target, bool keep) int dist_y = target->mY - mY; // Must be standing to attack - if (mAction != STAND) return; + if (mAction != STAND) + return; if (abs(dist_y) >= abs(dist_x)) { -- cgit v1.2.3-70-g09d2