summaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
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)