From 141a65df6568c293a390816f524141823838b323 Mon Sep 17 00:00:00 2001 From: mostlikely4r Date: Tue, 21 Jan 2025 08:29:23 +0100 Subject: [PATCH] Travel: Fix improper check of last partition. --- playerbot/strategy/actions/ChooseTravelTargetAction.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/playerbot/strategy/actions/ChooseTravelTargetAction.cpp b/playerbot/strategy/actions/ChooseTravelTargetAction.cpp index df134439..3b01e3b4 100644 --- a/playerbot/strategy/actions/ChooseTravelTargetAction.cpp +++ b/playerbot/strategy/actions/ChooseTravelTargetAction.cpp @@ -629,13 +629,13 @@ void ChooseTravelTargetAction::ReportTravelTarget(Player* requester, TravelTarge } //Sets the target to the best destination. -bool ChooseTravelTargetAction::SetBestTarget(Player* requester, TravelTarget* target, PartitionedTravelList& travelPartitions, bool onlyActive) +bool ChooseTravelTargetAction::SetBestTarget(Player* requester, TravelTarget* target, PartitionedTravelList& partitionedList, bool onlyActive) { std::unordered_map isActive; bool hasTarget = false; - for (auto& [partition, travelPointList] : travelPartitions) + for (auto& [partition, travelPointList] : partitionedList) { for (auto& [destination, position, distance] : travelPointList) { @@ -644,7 +644,7 @@ bool ChooseTravelTargetAction::SetBestTarget(Player* requester, TravelTarget* ta if(isActive[destination] = destination->IsActive(bot, info)) { - if (partition != travelPartitions.end()->first && !urand(0, 10)) //10% chance to skip to a longer partition. + if (partition != travelPartitions.back() && !urand(0, 10)) //10% chance to skip to a longer partition. break; target->SetTarget(destination, position);