From 105745205558ea0f4f8705e1630a6f7055c68e34 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 30 Aug 2014 18:26:17 +0300 Subject: Fix heal action. --- src/actions/actions.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/actions/actions.cpp') 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()) -- cgit v1.2.3-70-g09d2