AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Acore::HealthOrderPred Class Reference

Public Member Functions

 HealthOrderPred (bool ascending=true)
 
bool operator() (WorldObject const *objA, WorldObject const *objB) const
 
bool operator() (Unit const *a, Unit const *b) const
 

Private Attributes

bool const _ascending
 

Detailed Description

Constructor & Destructor Documentation

◆ HealthOrderPred()

Acore::HealthOrderPred::HealthOrderPred ( bool  ascending = true)
inline
2318: _ascending(ascending) { }
bool const _ascending
Definition Unit.h:2337

Member Function Documentation

◆ operator()() [1/2]

bool Acore::HealthOrderPred::operator() ( Unit const *  a,
Unit const *  b 
) const
inline
2330 {
2331 uint32 rA = a ? a->GetHealth() : 0;
2332 uint32 rB = b ? b->GetHealth() : 0;
2333 return _ascending ? rA < rB : rA > rB;
2334 }
std::uint32_t uint32
Definition Define.h:107

References _ascending, and Unit::GetHealth().

◆ operator()() [2/2]

bool Acore::HealthOrderPred::operator() ( WorldObject const *  objA,
WorldObject const *  objB 
) const
inline
2321 {
2322 Unit const* a = objA->ToUnit();
2323 Unit const* b = objB->ToUnit();
2324 uint32 rA = a ? a->GetHealth() : 0;
2325 uint32 rB = b ? b->GetHealth() : 0;
2326 return _ascending ? rA < rB : rA > rB;
2327 }
Unit * ToUnit()
Definition Object.h:210
Definition Unit.h:664
uint32 GetHealth() const
Definition Unit.h:1108

References _ascending, Unit::GetHealth(), and Object::ToUnit().

Member Data Documentation

◆ _ascending

bool const Acore::HealthOrderPred::_ascending
private

Referenced by operator()(), and operator()().


The documentation for this class was generated from the following file: