diff options
author | Socapex <philippe_groarke@yahoo.ca> | 2013-01-19 21:02:01 -0500 |
---|---|---|
committer | Socapex <philippe_groarke@yahoo.ca> | 2013-01-19 21:02:01 -0500 |
commit | df606ace309acaf0c78f52e1f98eabed6c844ae2 (patch) | |
tree | d9799b0e4a507d9eacbbafc1755eecea03f0b373 /src/actionmanager.cpp | |
parent | d0169223b889a115b486e974e5b287c3ccb00d85 (diff) | |
parent | 678d4e70999ade5a36862039875aa5564291d09d (diff) | |
download | plus-df606ace309acaf0c78f52e1f98eabed6c844ae2.tar.gz plus-df606ace309acaf0c78f52e1f98eabed6c844ae2.tar.bz2 plus-df606ace309acaf0c78f52e1f98eabed6c844ae2.tar.xz plus-df606ace309acaf0c78f52e1f98eabed6c844ae2.zip |
Merge remote-tracking branch 'upstream/master' into osx
Diffstat (limited to 'src/actionmanager.cpp')
-rw-r--r-- | src/actionmanager.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp index 337fc4102..d7e0f361c 100644 --- a/src/actionmanager.cpp +++ b/src/actionmanager.cpp @@ -1,6 +1,6 @@ /* * The ManaPlus Client - * Copyright (C) 2012 The ManaPlus Developers + * Copyright (C) 2012-2013 The ManaPlus Developers * * This file is part of The ManaPlus Client. * @@ -937,7 +937,21 @@ impHandler0(talk) { if (player_node) { - Being *const target = player_node->getTarget(); + Being *target = player_node->getTarget(); + if (!target) + { + target = actorSpriteManager->findNearestLivingBeing( + player_node, 1, ActorSprite::NPC); + // ignore closest target if distance in each direction more than 1 + if (target) + { + if (abs(target->getTileX() - player_node->getTileX()) > 1 + || abs(target->getTileY() - player_node->getTileY()) > 1) + { + return true; + } + } + } if (target) { if (target->canTalk()) |