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:
Xanadu
2010-05-30 04:23:27 +02:00
parent 14382dd1fe
commit 7fbeef3d09
13 changed files with 105 additions and 235 deletions
@@ -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)))
{