summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-05-10 18:04:28 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-05-10 18:04:28 +0200
commita76ce742cdf160909bfd72747e07adff687f0045 (patch)
tree21d156567b9edcf78c6047287d57fb997527f867
parent914271405ecf2735a39193661b0a5e31c6ea3b57 (diff)
downloadmana-a76ce742cdf160909bfd72747e07adff687f0045.tar.gz
mana-a76ce742cdf160909bfd72747e07adff687f0045.tar.bz2
mana-a76ce742cdf160909bfd72747e07adff687f0045.tar.xz
mana-a76ce742cdf160909bfd72747e07adff687f0045.zip
Stop attacking when walking away
By setting mKeepAttacking to false when setting a destination.
-rw-r--r--src/localplayer.cpp9
1 files changed, 6 insertions, 3 deletions
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))
{