From 6722d5773bb9cb71bec870b214b4f34bbe6d0b08 Mon Sep 17 00:00:00 2001 From: Fedja Beader Date: Sat, 22 Mar 2025 00:08:48 +0100 Subject: Cleanup findNearestLivingBeing: rename index -> closestPriority --- src/actormanager.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/actormanager.cpp b/src/actormanager.cpp index 4324bf5d7..d30ddbc3a 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -1288,9 +1288,9 @@ Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing, return *i; } - int index = defaultPriorityIndex; Being *closestBeing = nullptr; int closestDistSq = maxDistSq + 1; + int closestPriority = defaultPriorityIndex; FOR_EACH (ActorSprites::iterator, i, mActors) { @@ -1371,12 +1371,12 @@ Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing, if (it2 != priorityMobsMap.end()) w2 = (*it2).second; - if ((w2 < index && distSq <= maxDistSq) || - (w2 == index && distSq < closestDistSq)) + if ((w2 < closestPriority && distSq <= maxDistSq) || + (w2 == closestPriority && distSq < closestDistSq)) { closestBeing = being; closestDistSq = distSq; - index = w2; + closestPriority = w2; continue; } } @@ -1388,9 +1388,9 @@ Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing, const StringIntMapCIter it1 = priorityMobsMap.find( being->getName()); if (it1 != priorityMobsMap.end()) - index = (*it1).second; + closestPriority = it1->second; else - index = defaultPriorityIndex; + closestPriority = defaultPriorityIndex; } } } -- cgit v1.2.3-70-g09d2