summaryrefslogtreecommitdiff
path: root/src/actions
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-30 18:26:17 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-30 19:07:18 +0300
commit105745205558ea0f4f8705e1630a6f7055c68e34 (patch)
tree32d5c8d80925bd3119d5d3419c928a6b23c47d05 /src/actions
parent5ecad5ededdeace6024d8bcd59681677cf4953e1 (diff)
downloadplus-105745205558ea0f4f8705e1630a6f7055c68e34.tar.gz
plus-105745205558ea0f4f8705e1630a6f7055c68e34.tar.bz2
plus-105745205558ea0f4f8705e1630a6f7055c68e34.tar.xz
plus-105745205558ea0f4f8705e1630a6f7055c68e34.zip
Fix heal action.
Diffstat (limited to 'src/actions')
-rw-r--r--src/actions/actions.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index cb13bb01e..572068a63 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -292,7 +292,7 @@ impHandler0(dropItem)
impHandler(heal)
{
- if (actorManager)
+ if (actorManager && localPlayer)
{
if (!event.args.empty())
{
@@ -301,20 +301,23 @@ impHandler(heal)
if (being)
actorManager->heal(being);
}
- else if (inputManager.isActionActive(InputAction::STOP_ATTACK))
+ else
{
Being *target = localPlayer->getTarget();
- if (!target || target->getType() != ActorType::PLAYER)
+ if (inputManager.isActionActive(InputAction::STOP_ATTACK))
{
- target = actorManager->findNearestLivingBeing(
- localPlayer, 10, ActorType::PLAYER, true);
- if (target)
- localPlayer->setTarget(target);
+ if (!target || target->getType() != ActorType::PLAYER)
+ {
+ target = actorManager->findNearestLivingBeing(
+ localPlayer, 10, ActorType::PLAYER, true);
+ }
}
- }
- else
- {
- actorManager->heal(localPlayer);
+ else
+ {
+ if (!target)
+ target = localPlayer;
+ }
+ actorManager->heal(target);
}
if (Game::instance())