diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-10 18:04:28 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-10 18:04:28 +0200 |
commit | a76ce742cdf160909bfd72747e07adff687f0045 (patch) | |
tree | 21d156567b9edcf78c6047287d57fb997527f867 /src/localplayer.cpp | |
parent | 914271405ecf2735a39193661b0a5e31c6ea3b57 (diff) | |
download | mana-client-a76ce742cdf160909bfd72747e07adff687f0045.tar.gz mana-client-a76ce742cdf160909bfd72747e07adff687f0045.tar.bz2 mana-client-a76ce742cdf160909bfd72747e07adff687f0045.tar.xz mana-client-a76ce742cdf160909bfd72747e07adff687f0045.zip |
Stop attacking when walking away
By setting mKeepAttacking to false when setting a destination.
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r-- | src/localplayer.cpp | 9 |
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)) { |