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

#include <Unit.h>

Public Member Functions

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

Private Attributes

Powers const _power
 
bool const _ascending
 

Constructor & Destructor Documentation

Trinity::PowerPctOrderPred::PowerPctOrderPred ( Powers  power,
bool  ascending = true 
)
inline
2373 : _power(power), _ascending(ascending) { }
bool const _ascending
Definition: Unit.h:2393
Powers const _power
Definition: Unit.h:2392

Member Function Documentation

bool Trinity::PowerPctOrderPred::operator() ( WorldObject const objA,
WorldObject const objB 
) const
inline
2376  {
2377  Unit const* a = objA->ToUnit();
2378  Unit const* b = objB->ToUnit();
2379  float rA = (a && a->GetMaxPower(_power)) ? float(a->GetPower(_power)) / float(a->GetMaxPower(_power)) : 0.0f;
2380  float rB = (b && b->GetMaxPower(_power)) ? float(b->GetPower(_power)) / float(b->GetMaxPower(_power)) : 0.0f;
2381  return _ascending ? rA < rB : rA > rB;
2382  }
bool const _ascending
Definition: Unit.h:2393
Powers const _power
Definition: Unit.h:2392
int32 GetPower(Powers power) const
Definition: Unit.cpp:11589
int32 GetMaxPower(Powers power) const
Definition: Unit.cpp:11598
Definition: Unit.h:1305
Unit * ToUnit()
Definition: Object.h:197

+ Here is the call graph for this function:

bool Trinity::PowerPctOrderPred::operator() ( Unit const a,
Unit const b 
) const
inline
2385  {
2386  float rA = a->GetMaxPower(_power) ? float(a->GetPower(_power)) / float(a->GetMaxPower(_power)) : 0.0f;
2387  float rB = b->GetMaxPower(_power) ? float(b->GetPower(_power)) / float(b->GetMaxPower(_power)) : 0.0f;
2388  return _ascending ? rA < rB : rA > rB;
2389  }
bool const _ascending
Definition: Unit.h:2393
Powers const _power
Definition: Unit.h:2392

+ Here is the call graph for this function:

Member Data Documentation

bool const Trinity::PowerPctOrderPred::_ascending
private
Powers const Trinity::PowerPctOrderPred::_power
private

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