From c4a9748e841fd8620e7e9d230aad8964f424bb08 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 20 Sep 2015 22:26:00 +0300 Subject: Add function for selecting new target. --- src/actions/target.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/actions') diff --git a/src/actions/target.cpp b/src/actions/target.cpp index f5bf636d4..a0615143c 100644 --- a/src/actions/target.cpp +++ b/src/actions/target.cpp @@ -35,16 +35,8 @@ namespace Actions static bool setTarget(const ActorTypeT type, const AllowSort allowSort) { - if (actorManager && localPlayer) - { - Being *const target = actorManager->findNearestLivingBeing( - localPlayer, 20, type, allowSort); - - if (target && target != localPlayer->getTarget()) - localPlayer->setTarget(target); - - return true; - } + if (localPlayer) + return localPlayer->setNewTarget(type, allowSort) != nullptr; return false; } -- cgit v1.2.3-70-g09d2