diff options
| author | Ovahlord <dreadkiller@gmx.de> | 2020-08-29 22:48:22 +0200 |
|---|---|---|
| committer | Ovahlord <dreadkiller@gmx.de> | 2020-08-29 22:49:58 +0200 |
| commit | c08180d9bc7cb203746650a9b2fc775efbeb2540 (patch) | |
| tree | 54fd533141c28016d42500252864f0ae37d4fc7a /src | |
| parent | c1e4cfd07eee19069a15e9b82a308d8a914d5637 (diff) | |
Core/AI: SortByDistance will now sort the referenced list instead of a copy of it. This fixes MinDistance and MaxDistance target selection
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/AI/CoreAI/UnitAI.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/AI/CoreAI/UnitAI.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp index 1a873e8a34d..f98e9581591 100644 --- a/src/server/game/AI/CoreAI/UnitAI.cpp +++ b/src/server/game/AI/CoreAI/UnitAI.cpp @@ -238,7 +238,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)); } diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index c07c279406b..4504c87c2ec 100644 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -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 |
