TrinityCore
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
 

Detailed Description

Definition at line 2102 of file Unit.h.

Constructor & Destructor Documentation

◆ PowerPctOrderPred()

Trinity::PowerPctOrderPred::PowerPctOrderPred ( Powers  power,
bool  ascending = true 
)
inline

Definition at line 2105 of file Unit.h.

2105: _power(power), _ascending(ascending) { }
bool const _ascending
Definition: Unit.h:2125
Powers const _power
Definition: Unit.h:2124

Member Function Documentation

◆ operator()() [1/2]

bool Trinity::PowerPctOrderPred::operator() ( Unit const *  a,
Unit const *  b 
) const
inline

Definition at line 2116 of file Unit.h.

2117 {
2118 float rA = a->GetPowerPct(_power);
2119 float rB = b->GetPowerPct(_power);
2120 return _ascending ? rA < rB : rA > rB;
2121 }
+ Here is the call graph for this function:

◆ operator()() [2/2]

bool Trinity::PowerPctOrderPred::operator() ( WorldObject const *  objA,
WorldObject const *  objB 
) const
inline

Definition at line 2107 of file Unit.h.

2108 {
2109 Unit const* a = objA->ToUnit();
2110 Unit const* b = objB->ToUnit();
2111 float rA = a ? a->GetPowerPct(_power) : 0.0f;
2112 float rB = b ? b->GetPowerPct(_power) : 0.0f;
2113 return _ascending ? rA < rB : rA > rB;
2114 }
static Unit * ToUnit(Object *o)
Definition: Object.h:212
Definition: Unit.h:747
float GetPowerPct(Powers power) const
Definition: Unit.h:927
+ Here is the call graph for this function:

Member Data Documentation

◆ _ascending

bool const Trinity::PowerPctOrderPred::_ascending
private

Definition at line 2125 of file Unit.h.

◆ _power

Powers const Trinity::PowerPctOrderPred::_power
private

Definition at line 2124 of file Unit.h.


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