summaryrefslogtreecommitdiff
path: root/src/actions
diff options
context:
space:
mode:
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())