From fb198a2e9c3e06f9cff759b25fd57fa3f3051ccf Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 5 May 2011 01:27:21 +0300 Subject: Fix monsters selection if monster added to priority list and option "cycle monster target" disabled. --- src/actorspritemanager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') 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)) { -- cgit v1.2.3-70-g09d2