summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-05-05 01:27:21 +0300
committerAndrei Karas <akaras@inbox.ru>2011-05-05 01:27:21 +0300
commitfb198a2e9c3e06f9cff759b25fd57fa3f3051ccf (patch)
tree448c8e4bf66fdfea1ac5ebe5ebbf07ab4ac7a0bc
parentb0fc97aa4fc9ddf9fbe006c876d6d6bdcc883de0 (diff)
downloadmanaplus-fb198a2e9c3e06f9cff759b25fd57fa3f3051ccf.tar.gz
manaplus-fb198a2e9c3e06f9cff759b25fd57fa3f3051ccf.tar.bz2
manaplus-fb198a2e9c3e06f9cff759b25fd57fa3f3051ccf.tar.xz
manaplus-fb198a2e9c3e06f9cff759b25fd57fa3f3051ccf.zip
Fix monsters selection if monster added to priority list
and option "cycle monster target" disabled.
-rw-r--r--src/actorspritemanager.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp
index 6162ba727..3f37ce99f 100644
--- a/src/actorspritemanager.cpp
+++ b/src/actorspritemanager.cpp
@@ -766,6 +766,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
else
{
int dist = 0;
+ int index = defaultPriorityIndex;
for (ActorSprites::const_iterator i = mActors.begin(),
i_end = mActors.end();
@@ -797,7 +798,6 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
bool valid = validateBeing(aroundBeing, being, type, excluded, 50);
int d = being->getDistance();
- int index = defaultPriorityIndex;
// logger->log("dist: %d", dist);
// logger->log("name: %s, %d, %d", being->getName().c_str(), (int)valid, d);
if (being->getType() != Being::MONSTER
@@ -807,9 +807,12 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
+ (being->getTileY() - y) * (being->getTileY() - y);
}
+ if (!valid)
+ continue;
+
// logger->log("being name:" + being->getName());
+// logger->log("index:" + toString(index));
// logger->log("d:" + toString(d));
-// logger->log("valid:" + toString(valid))
if (valid && !filtered && (d <= dist || closestBeing == 0))
{