diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-08-30 18:26:17 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-08-30 19:07:18 +0300 |
commit | 105745205558ea0f4f8705e1630a6f7055c68e34 (patch) | |
tree | 32d5c8d80925bd3119d5d3419c928a6b23c47d05 /src/actions/actions.cpp | |
parent | 5ecad5ededdeace6024d8bcd59681677cf4953e1 (diff) | |
download | manaplus-105745205558ea0f4f8705e1630a6f7055c68e34.tar.gz manaplus-105745205558ea0f4f8705e1630a6f7055c68e34.tar.bz2 manaplus-105745205558ea0f4f8705e1630a6f7055c68e34.tar.xz manaplus-105745205558ea0f4f8705e1630a6f7055c68e34.zip |
Fix heal action.
Diffstat (limited to 'src/actions/actions.cpp')
-rw-r--r-- | src/actions/actions.cpp | 25 |
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()) |