aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOvahlord <dreadkiller@gmx.de>2020-08-29 22:48:22 +0200
committerShauren <shauren.trinity@gmail.com>2022-02-04 13:05:36 +0100
commit175fb7056b32d5455b59d83cc0f46fc55d905307 (patch)
tree1f3159191554d8a03f3ea52d2f260a7c55d52397 /src
parent7cd98cd7d2e5723abdad12aed19213cb5b619189 (diff)
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 c08180d9bc7cb203746650a9b2fc775efbeb2540)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/CoreAI/UnitAI.cpp2
-rw-r--r--src/server/game/AI/CoreAI/UnitAI.h2
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 243d45fdcb6..e5e8c921010 100644
--- a/src/server/game/AI/CoreAI/UnitAI.cpp
+++ b/src/server/game/AI/CoreAI/UnitAI.cpp
@@ -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));
}
diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h
index 4d660a4289d..38519917bd5 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