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
395 : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) {}
Unit *& i_object
Definition: GridNotifiers.h:391
Check & i_check
Definition: GridNotifiers.h:392
uint32 i_phaseMask
Definition: GridNotifiers.h:390

Member Function Documentation

◆ Visit() [1/3]

template<class Check >
void Acore::UnitSearcher< Check >::Visit ( CreatureMapType m)
347{
348 // already found
349 if (i_object)
350 return;
351
352 for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
353 {
354 if (!itr->GetSource()->InSamePhase(i_phaseMask))
355 continue;
356
357 if (i_check(itr->GetSource()))
358 {
359 i_object = itr->GetSource();
360 return;
361 }
362 }
363}
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
400{}

◆ Visit() [3/3]

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

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