AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Acore::UnitSearcher< Check > Struct Template Reference

#include "GridNotifiers.h"

Public Member Functions

 UnitSearcher (WorldObject const *searcher, Unit *&result, Check &check)
 
void Visit (CreatureMapType &m)
 
void Visit (PlayerMapType &m)
 
template<class NOT_INTERESTED >
void Visit (GridRefMgr< NOT_INTERESTED > &)
 

Public Attributes

uint32 i_phaseMask
 
Unit *& i_object
 
Check & i_check
 

Detailed Description

template<class Check>
struct Acore::UnitSearcher< Check >

Constructor & Destructor Documentation

◆ UnitSearcher()

template<class Check >
Acore::UnitSearcher< Check >::UnitSearcher ( WorldObject const *  searcher,
Unit *&  result,
Check &  check 
)
inline
392 : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) {}
Unit *& i_object
Definition: GridNotifiers.h:388
Check & i_check
Definition: GridNotifiers.h:389
uint32 i_phaseMask
Definition: GridNotifiers.h:387

Member Function Documentation

◆ Visit() [1/3]

template<class Check >
void Acore::UnitSearcher< Check >::Visit ( CreatureMapType m)
351{
352 // already found
353 if (i_object)
354 return;
355
356 for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
357 {
358 if (!itr->GetSource()->InSamePhase(i_phaseMask))
359 continue;
360
361 if (i_check(itr->GetSource()))
362 {
363 i_object = itr->GetSource();
364 return;
365 }
366 }
367}
Definition: LinkedList.h:139
iterator begin()
Definition: GridRefMgr.h:35
iterator end()
Definition: GridRefMgr.h:36

References GridRefMgr< OBJECT >::begin(), and GridRefMgr< OBJECT >::end().

◆ Visit() [2/3]

template<class Check >
template<class NOT_INTERESTED >
void Acore::UnitSearcher< Check >::Visit ( GridRefMgr< NOT_INTERESTED > &  )
inline
397{}

◆ Visit() [3/3]

template<class Check >
void Acore::UnitSearcher< Check >::Visit ( PlayerMapType m)
371{
372 // already found
373 if (i_object)
374 return;
375
376 for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
377 {
378 if (!itr->GetSource()->InSamePhase(i_phaseMask))
379 continue;
380
381 if (i_check(itr->GetSource()))
382 {
383 i_object = itr->GetSource();
384 return;
385 }
386 }
387}

References GridRefMgr< OBJECT >::begin(), and GridRefMgr< OBJECT >::end().

Member Data Documentation

◆ i_check

template<class Check >
Check& Acore::UnitSearcher< Check >::i_check

◆ i_object

template<class Check >
Unit*& Acore::UnitSearcher< Check >::i_object

◆ i_phaseMask

template<class Check >
uint32 Acore::UnitSearcher< Check >::i_phaseMask