diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-05-05 01:27:21 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-05-05 21:31:15 +0300 |
commit | 274d96292571495a45d32364c36531e7ff35aff0 (patch) | |
tree | 81e12194f2eeb0234ee3f11879555612595a5b5e /src/actorspritemanager.cpp | |
parent | bba99b414167d9adb40622d8fc8c1e9dc814e956 (diff) | |
download | plus-274d96292571495a45d32364c36531e7ff35aff0.tar.gz plus-274d96292571495a45d32364c36531e7ff35aff0.tar.bz2 plus-274d96292571495a45d32364c36531e7ff35aff0.tar.xz plus-274d96292571495a45d32364c36531e7ff35aff0.zip |
Fix monsters selection if monster added to priority list
and option "cycle monster target" disabled.
Diffstat (limited to 'src/actorspritemanager.cpp')
-rw-r--r-- | src/actorspritemanager.cpp | 7 |
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)) { |