|
|
|
|
@ -557,10 +557,10 @@ template <typename Predicate>
|
|
|
|
|
return CollectNearbyObjectTrackerCandidates(playerPosition, maxDistance, IsTrackedMiscInteractableObject); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[[nodiscard]] std::vector<TrackerCandidate> CollectNearbyMonsterTrackerCandidates(Point playerPosition, int maxDistance) |
|
|
|
|
{ |
|
|
|
|
std::vector<TrackerCandidate> result; |
|
|
|
|
result.reserve(ActiveMonsterCount); |
|
|
|
|
[[nodiscard]] std::vector<TrackerCandidate> CollectNearbyMonsterTrackerCandidates(Point playerPosition, int maxDistance) |
|
|
|
|
{ |
|
|
|
|
std::vector<TrackerCandidate> result; |
|
|
|
|
result.reserve(ActiveMonsterCount); |
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < ActiveMonsterCount; ++i) { |
|
|
|
|
const int monsterId = static_cast<int>(ActiveMonsters[i]); |
|
|
|
|
@ -571,15 +571,15 @@ template <typename Predicate>
|
|
|
|
|
const int distance = playerPosition.ApproxDistance(monster.position.future); |
|
|
|
|
if (distance > maxDistance) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
result.push_back(TrackerCandidate { |
|
|
|
|
.id = monsterId, |
|
|
|
|
.distance = distance, |
|
|
|
|
.name = monster.name(), |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::sort(result.begin(), result.end(), IsBetterTrackerCandidate); |
|
|
|
|
|
|
|
|
|
result.push_back(TrackerCandidate { |
|
|
|
|
.id = monsterId, |
|
|
|
|
.distance = distance, |
|
|
|
|
.name = MonsterLabelForSpeech(monster), |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::sort(result.begin(), result.end(), IsBetterTrackerCandidate); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -1896,10 +1896,10 @@ void NavigateToTrackerTargetKeyPressed()
|
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case TrackerTargetCategory::Monsters: { |
|
|
|
|
const std::vector<TrackerCandidate> nearbyCandidates = CollectNearbyMonsterTrackerCandidates(playerPosition, TrackerCycleDistanceTiles); |
|
|
|
|
if (cycleTarget) { |
|
|
|
|
targetId = FindNextTrackerCandidateId(nearbyCandidates, lockedTargetId); |
|
|
|
|
case TrackerTargetCategory::Monsters: { |
|
|
|
|
const std::vector<TrackerCandidate> nearbyCandidates = CollectNearbyMonsterTrackerCandidates(playerPosition, TrackerCycleDistanceTiles); |
|
|
|
|
if (cycleTarget) { |
|
|
|
|
targetId = FindNextTrackerCandidateId(nearbyCandidates, lockedTargetId); |
|
|
|
|
if (!targetId) { |
|
|
|
|
if (nearbyCandidates.empty()) |
|
|
|
|
SpeakText(_("No monsters found."), true); |
|
|
|
|
@ -1926,15 +1926,15 @@ void NavigateToTrackerTargetKeyPressed()
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
lockedTargetId = *targetId; |
|
|
|
|
const Monster &tracked = Monsters[*targetId]; |
|
|
|
|
|
|
|
|
|
targetName = tracked.name(); |
|
|
|
|
DecorateTrackerTargetNameWithOrdinalIfNeeded(*targetId, targetName, nearbyCandidates); |
|
|
|
|
if (!cycleTarget) { |
|
|
|
|
targetPosition = tracked.position.tile; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
lockedTargetId = *targetId; |
|
|
|
|
const Monster &tracked = Monsters[*targetId]; |
|
|
|
|
|
|
|
|
|
targetName = MonsterLabelForSpeech(tracked); |
|
|
|
|
DecorateTrackerTargetNameWithOrdinalIfNeeded(*targetId, targetName, nearbyCandidates); |
|
|
|
|
if (!cycleTarget) { |
|
|
|
|
targetPosition = tracked.position.tile; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case TrackerTargetCategory::DeadBodies: { |
|
|
|
|
|