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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user