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
2320: _ascending(ascending) { }
bool const _ascending
Definition Unit.h:2339

Member Function Documentation

◆ operator()() [1/2]

bool Acore::HealthOrderPred::operator() ( Unit const *  a,
Unit const *  b 
) const
inline
2332 {
2333 uint32 rA = a ? a->GetHealth() : 0;
2334 uint32 rB = b ? b->GetHealth() : 0;
2335 return _ascending ? rA < rB : rA > rB;
2336 }
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
2323 {
2324 Unit const* a = objA->ToUnit();
2325 Unit const* b = objB->ToUnit();
2326 uint32 rA = a ? a->GetHealth() : 0;
2327 uint32 rB = b ? b->GetHealth() : 0;
2328 return _ascending ? rA < rB : rA > rB;
2329 }
Unit * ToUnit()
Definition Object.h:210
Definition Unit.h:665
uint32 GetHealth() const
Definition Unit.h:1109

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: