mirror of
https://github.com/araxiaonline/TrinityCore2.git
synced 2026-06-21 07:11:59 -04:00
Cleaned up and unified various sort predicates and moved them to Trinity namespace, replaced priority queues with sorts and purged some unused code.
--HG-- branch : trunk
This commit is contained in:
@@ -318,7 +318,7 @@ struct boss_archimondeAI : public hyjal_trashAI
|
||||
if (targets.empty())
|
||||
return false;
|
||||
|
||||
targets.sort(ObjectDistanceOrder(me));
|
||||
targets.sort(Trinity::ObjectDistanceOrderPred(me));
|
||||
Unit *pTarget = targets.front();
|
||||
if (pTarget)
|
||||
{
|
||||
|
||||
@@ -146,7 +146,7 @@ struct boss_gurtogg_bloodboilAI : public ScriptedAI
|
||||
}
|
||||
|
||||
//Sort the list of players
|
||||
targets.sort(ObjectDistanceOrderReversed(me));
|
||||
targets.sort(Trinity::ObjectDistanceOrderPred(me, false));
|
||||
//Resize so we only get top 5
|
||||
targets.resize(5);
|
||||
|
||||
|
||||
@@ -399,7 +399,7 @@ struct boss_essence_of_sufferingAI : public ScriptedAI
|
||||
}
|
||||
if (targets.empty())
|
||||
return; // No targets added for some reason. No point continuing.
|
||||
targets.sort(ObjectDistanceOrder(me)); // Sort players by distance.
|
||||
targets.sort(Trinity::ObjectDistanceOrderPred(me)); // Sort players by distance.
|
||||
targets.resize(1); // Only need closest target.
|
||||
Unit *pTarget = targets.front(); // Get the first target.
|
||||
if (pTarget)
|
||||
|
||||
@@ -153,7 +153,7 @@ struct mob_shadowy_constructAI : public ScriptedAI
|
||||
if (pUnit && pUnit->isAlive())
|
||||
targets.push_back(pUnit);
|
||||
}
|
||||
targets.sort(ObjectDistanceOrder(me));
|
||||
targets.sort(Trinity::ObjectDistanceOrderPred(me));
|
||||
Unit *pTarget = targets.front();
|
||||
if (pTarget && me->IsWithinDistInMap(pTarget, me->GetAttackDistance(pTarget)))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user