TrinityCore
Loading...
Searching...
No Matches
FarthestTargetSelector Struct Reference

#include <UnitAICommon.h>

Public Member Functions

 FarthestTargetSelector (Unit const *unit, float dist, bool playerOnly, bool inLos)
 
bool operator() (Unit const *target) const
 

Private Attributes

Unit const * _me
 
float _dist
 
bool _playerOnly
 
bool _inLos
 

Constructor & Destructor Documentation

◆ FarthestTargetSelector()

FarthestTargetSelector::FarthestTargetSelector ( Unit const *  unit,
float  dist,
bool  playerOnly,
bool  inLos 
)
inline
107: _me(unit), _dist(dist), _playerOnly(playerOnly), _inLos(inLos) { }
Unit const * _me
Definition: UnitAICommon.h:111
float _dist
Definition: UnitAICommon.h:112
bool _playerOnly
Definition: UnitAICommon.h:113
bool _inLos
Definition: UnitAICommon.h:114

Member Function Documentation

◆ operator()()

bool FarthestTargetSelector::operator() ( Unit const *  target) const
172{
173 if (!_me || !target)
174 return false;
175
176 if (_playerOnly && target->GetTypeId() != TYPEID_PLAYER)
177 return false;
178
179 if (_dist > 0.0f && !_me->IsWithinCombatRange(target, _dist))
180 return false;
181
182 if (_inLos && !_me->IsWithinLOSInMap(target))
183 return false;
184
185 return true;
186}
@ TYPEID_PLAYER
Definition: ObjectGuid.h:39
bool IsWithinCombatRange(Unit const *obj, float dist2compare) const
Definition: Unit.cpp:617
bool IsWithinLOSInMap(WorldObject const *obj, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing) const
Definition: Object.cpp:1153
+ Here is the call graph for this function:

Member Data Documentation

◆ _dist

float FarthestTargetSelector::_dist
private

◆ _inLos

bool FarthestTargetSelector::_inLos
private

◆ _me

Unit const* FarthestTargetSelector::_me
private

◆ _playerOnly

bool FarthestTargetSelector::_playerOnly
private

The documentation for this struct was generated from the following files: