From f80e8769ff5c78255bd5e09a991ada83b7ed1aa2 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Fri, 12 Mar 2010 22:36:18 -0700 Subject: 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 --- src/localplayer.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/localplayer.cpp') 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(mTarget)->setShowName(false); + mTarget->setShowName(false); mTarget = target; if (target && target->getType() == Being::MONSTER) - static_cast(target)->setShowName(true); + target->setShowName(true); } void LocalPlayer::setDestination(int x, int y) -- cgit v1.2.3-70-g09d2