Skip to content

Commit

Permalink
Travel: Fix improper check of last partition.
Browse files Browse the repository at this point in the history
  • Loading branch information
mostlikely4r committed Jan 21, 2025
1 parent e403349 commit 141a65d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions playerbot/strategy/actions/ChooseTravelTargetAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<TravelDestination*, bool> isActive;

bool hasTarget = false;

for (auto& [partition, travelPointList] : travelPartitions)
for (auto& [partition, travelPointList] : partitionedList)
{
for (auto& [destination, position, distance] : travelPointList)
{
Expand All @@ -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);
Expand Down

0 comments on commit 141a65d

Please sign in to comment.