diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-09-20 22:26:00 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-09-20 22:26:00 +0300 |
commit | c4a9748e841fd8620e7e9d230aad8964f424bb08 (patch) | |
tree | deeeac5217f0d73e5c5176399685ee74bea36460 /src/being/localplayer.cpp | |
parent | 2ac58b6b39b155a9033677f225fe5c56b63cb6b1 (diff) | |
download | manaplus-c4a9748e841fd8620e7e9d230aad8964f424bb08.tar.gz manaplus-c4a9748e841fd8620e7e9d230aad8964f424bb08.tar.bz2 manaplus-c4a9748e841fd8620e7e9d230aad8964f424bb08.tar.xz manaplus-c4a9748e841fd8620e7e9d230aad8964f424bb08.zip |
Add function for selecting new target.
Diffstat (limited to 'src/being/localplayer.cpp')
-rw-r--r-- | src/being/localplayer.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 6722d5a4b..cde59bd7a 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -554,6 +554,22 @@ void LocalPlayer::setTarget(Being *const target) target->setShowName(true); } +Being *LocalPlayer::setNewTarget(const ActorTypeT type, + const AllowSort allowSort) +{ + if (actorManager) + { + Being *const target = actorManager->findNearestLivingBeing( + localPlayer, 20, type, allowSort); + + if (target && target != mTarget) + localPlayer->setTarget(target); + + return target; + } + return nullptr; +} + void LocalPlayer::setDestination(const int x, const int y) { mActivityTime = cur_time; |