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
+2 -10
View File
@@ -245,22 +245,14 @@ void ThreatContainer::modifyThreatPercent(Unit *pVictim, int32 iPercent)
ref->addThreatPercent(iPercent);
}
//============================================================
bool HostileReferenceSortPredicate(const HostileReference* lhs, const HostileReference* rhs)
{
// std::list::sort ordering predicate must be: (Pred(x,y)&&Pred(y,x)) == false
return lhs->getThreat() > rhs->getThreat(); // reverse sorting
}
//============================================================
// Check if the list is dirty and sort if necessary
void ThreatContainer::update()
{
if (iDirty && iThreatList.size() >1)
{
iThreatList.sort(HostileReferenceSortPredicate);
{
iThreatList.sort(Trinity::ThreatOrderPred());
}
iDirty = false;
}