summaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-03-12 22:36:18 -0700
committerJared Adams <jaxad0127@gmail.com>2010-03-12 23:53:55 -0700
commitf80e8769ff5c78255bd5e09a991ada83b7ed1aa2 (patch)
treea104ffd960173e7232a70a5d78b4551751ad303c /src/localplayer.cpp
parentef3685ef63999b7132fa7b6f8ebc9a3387972e53 (diff)
downloadmana-f80e8769ff5c78255bd5e09a991ada83b7ed1aa2.tar.gz
mana-f80e8769ff5c78255bd5e09a991ada83b7ed1aa2.tar.bz2
mana-f80e8769ff5c78255bd5e09a991ada83b7ed1aa2.tar.xz
mana-f80e8769ff5c78255bd5e09a991ada83b7ed1aa2.zip
Fix some issues with Being deletion
Clear the Viewport's hover being when it gets removed and make sure LocalPlayer's target pointer get's cleared. Reviewed-by: Freeyorp
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r--src/localplayer.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index dfee7cdc..6d53cac3 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -422,10 +422,11 @@ Being *LocalPlayer::getTarget() const
void LocalPlayer::setTarget(Being *target)
{
- if (mLastTarget != -1 || target == this)
+ if ((mLastTarget != -1 || target == this) && target)
return;
- mLastTarget = tick_time;
+ if (target)
+ mLastTarget = tick_time;
if (target == mTarget)
return;
@@ -444,12 +445,12 @@ void LocalPlayer::setTarget(Being *target)
mTarget->untarget();
if (mTarget && mTarget->getType() == Being::MONSTER)
- static_cast<Monster *>(mTarget)->setShowName(false);
+ mTarget->setShowName(false);
mTarget = target;
if (target && target->getType() == Being::MONSTER)
- static_cast<Monster *>(target)->setShowName(true);
+ target->setShowName(true);
}
void LocalPlayer::setDestination(int x, int y)