mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/AI: SortByDistance will now sort the referenced list instead of a copy of it. This fixes MinDistance and MaxDistance target selection
(cherry picked from commit c08180d9bc)
This commit is contained in:
@@ -302,7 +302,7 @@ ThreatManager& UnitAI::GetThreatManager()
|
||||
return me->GetThreatManager();
|
||||
}
|
||||
|
||||
void UnitAI::SortByDistance(std::list<Unit*> list, bool ascending)
|
||||
void UnitAI::SortByDistance(std::list<Unit*>& list, bool ascending)
|
||||
{
|
||||
list.sort(Trinity::ObjectDistanceOrderPred(me, ascending));
|
||||
}
|
||||
|
||||
@@ -343,7 +343,7 @@ class TC_GAME_API UnitAI
|
||||
UnitAI& operator=(UnitAI const& right) = delete;
|
||||
|
||||
ThreatManager& GetThreatManager();
|
||||
void SortByDistance(std::list<Unit*> list, bool ascending = true);
|
||||
void SortByDistance(std::list<Unit*>& list, bool ascending = true);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user