TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Trinity::HealthPctOrderPred Class Reference

#include <Unit.h>

Public Member Functions

 HealthPctOrderPred (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
 

Constructor & Destructor Documentation

Trinity::HealthPctOrderPred::HealthPctOrderPred ( bool  ascending = true)
inline
2400 : _ascending(ascending) { }
bool const _ascending
Definition: Unit.h:2419

Member Function Documentation

bool Trinity::HealthPctOrderPred::operator() ( WorldObject const objA,
WorldObject const objB 
) const
inline
2403  {
2404  Unit const* a = objA->ToUnit();
2405  Unit const* b = objB->ToUnit();
2406  float rA = (a && a->GetMaxHealth()) ? float(a->GetHealth()) / float(a->GetMaxHealth()) : 0.0f;
2407  float rB = (b && b->GetMaxHealth()) ? float(b->GetHealth()) / float(b->GetMaxHealth()) : 0.0f;
2408  return _ascending ? rA < rB : rA > rB;
2409  }
uint32 GetMaxHealth() const
Definition: Unit.h:1427
bool const _ascending
Definition: Unit.h:2419
uint32 GetHealth() const
Definition: Unit.h:1426
Definition: Unit.h:1305
Unit * ToUnit()
Definition: Object.h:197

+ Here is the call graph for this function:

bool Trinity::HealthPctOrderPred::operator() ( Unit const a,
Unit const b 
) const
inline
2412  {
2413  float rA = a->GetMaxHealth() ? float(a->GetHealth()) / float(a->GetMaxHealth()) : 0.0f;
2414  float rB = b->GetMaxHealth() ? float(b->GetHealth()) / float(b->GetMaxHealth()) : 0.0f;
2415  return _ascending ? rA < rB : rA > rB;
2416  }
bool const _ascending
Definition: Unit.h:2419

+ Here is the call graph for this function:

Member Data Documentation

bool const Trinity::HealthPctOrderPred::_ascending
private

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