aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities
diff options
context:
space:
mode:
authorOvahlord <dreadkiller@gmx.de>2024-01-16 20:18:25 +0100
committerGitHub <noreply@github.com>2024-01-16 20:18:25 +0100
commit2f6ed2c203b16a1d1e85f61a8b8e2cf3d1a4e784 (patch)
tree95e239433e83a5a47c1b809bf0f3b1db99a02166 /src/server/game/Entities
parent39621fa41c96f66698055447c7a9134865e0f00b (diff)
Core/Units: moved health and power ordering predicates from Unit header into CommonPredicates (#29584)
Diffstat (limited to 'src/server/game/Entities')
-rw-r--r--src/server/game/Entities/Unit/Unit.h56
1 files changed, 0 insertions, 56 deletions
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index f49fc6f4511..e278384a315 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1972,60 +1972,4 @@ class TC_GAME_API Unit : public WorldObject
bool _isCombatDisallowed;
};
-namespace Trinity
-{
- // Binary predicate for sorting Units based on percent value of a power
- class PowerPctOrderPred
- {
- public:
- PowerPctOrderPred(Powers power, bool ascending = true) : _power(power), _ascending(ascending) { }
-
- bool operator()(WorldObject const* objA, WorldObject const* objB) const
- {
- Unit const* a = objA->ToUnit();
- Unit const* b = objB->ToUnit();
- float rA = a ? a->GetPowerPct(_power) : 0.0f;
- float rB = b ? b->GetPowerPct(_power) : 0.0f;
- return _ascending ? rA < rB : rA > rB;
- }
-
- bool operator()(Unit const* a, Unit const* b) const
- {
- float rA = a->GetPowerPct(_power);
- float rB = b->GetPowerPct(_power);
- return _ascending ? rA < rB : rA > rB;
- }
-
- private:
- Powers const _power;
- bool const _ascending;
- };
-
- // Binary predicate for sorting Units based on percent value of health
- class HealthPctOrderPred
- {
- public:
- HealthPctOrderPred(bool ascending = true) : _ascending(ascending) { }
-
- bool operator()(WorldObject const* objA, WorldObject const* objB) const
- {
- Unit const* a = objA->ToUnit();
- Unit const* b = objB->ToUnit();
- float rA = (a && a->GetMaxHealth()) ? float(a->GetHealth()) / float(a->GetMaxHealth()) : 0.0f;
- float rB = (b && b->GetMaxHealth()) ? float(b->GetHealth()) / float(b->GetMaxHealth()) : 0.0f;
- return _ascending ? rA < rB : rA > rB;
- }
-
- bool operator() (Unit const* a, Unit const* b) const
- {
- float rA = a->GetMaxHealth() ? float(a->GetHealth()) / float(a->GetMaxHealth()) : 0.0f;
- float rB = b->GetMaxHealth() ? float(b->GetHealth()) / float(b->GetMaxHealth()) : 0.0f;
- return _ascending ? rA < rB : rA > rB;
- }
-
- private:
- bool const _ascending;
- };
-}
-
#endif