OregonCore  revision be9e804-git
Your Favourite TBC server
NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES > Class Template Reference

#include <NGrid.h>

Public Types

typedef Grid< ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES > GridType
 

Public Member Functions

 NGrid (uint32 id, int32 x, int32 y, time_t expiry, bool unload=true)
 
GridTypeGetGridType (const uint32 x, const uint32 y)
 
GridType const & GetGridType (const uint32 x, const uint32 y) const
 
uint32 GetGridId (void) const
 
void SetGridId (const uint32 id) const
 
grid_state_t GetGridState (void) const
 
void SetGridState (grid_state_t s)
 
int32 getX () const
 
int32 getY () const
 
void link (GridRefManager< NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES > > *pTo)
 
bool isGridObjectDataLoaded () const
 
void setGridObjectDataLoaded (bool pLoaded)
 
GridInfogetGridInfoRef ()
 
const TimeTrackergetTimeTracker () const
 
bool getUnloadLock () const
 
void setUnloadExplicitLock (bool on)
 
void setUnloadReferenceLock (bool on)
 
void incUnloadActiveLock ()
 
void decUnloadActiveLock ()
 
void ResetTimeTracker (time_t interval)
 
void UpdateTimeTracker (time_t diff)
 
template<class T , class TT >
void VisitAllGrids (TypeContainerVisitor< T, TypeMapContainer< TT > > &visitor)
 
template<class T , class TT >
void VisitGrid (const uint32 x, const uint32 y, TypeContainerVisitor< T, TypeMapContainer< TT > > &visitor)
 
template<class T >
uint32 GetWorldObjectCountInNGrid () const
 

Private Attributes

uint32 i_gridId
 
GridInfo i_GridInfo
 
GridReference< NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES > > i_Reference
 
int32 i_x
 
int32 i_y
 
grid_state_t i_cellstate
 
GridType i_cells [N][N]
 
bool i_GridObjectDataLoaded
 

Detailed Description

template<uint32 N, class ACTIVE_OBJECT, class WORLD_OBJECT_TYPES, class GRID_OBJECT_TYPES>
class NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >

Definition at line 75 of file NGrid.h.

Member Typedef Documentation

template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
typedef Grid<ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GridType

Definition at line 78 of file NGrid.h.

Constructor & Destructor Documentation

template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::NGrid ( uint32  id,
int32  x,
int32  y,
time_t  expiry,
bool  unload = true 
)
inline

Definition at line 79 of file NGrid.h.

References GridInfo::GridInfo().

81  {
82  i_GridInfo = GridInfo(expiry, unload);
83  }
grid_state_t i_cellstate
Definition: NGrid.h:153
Definition: NGrid.h:30
int32 i_y
Definition: NGrid.h:152
bool i_GridObjectDataLoaded
Definition: NGrid.h:155
int32 i_x
Definition: NGrid.h:151
uint32 i_gridId
Definition: NGrid.h:148
GridInfo i_GridInfo
Definition: NGrid.h:149

Member Function Documentation

template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
void NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::decUnloadActiveLock ( )
inline

Definition at line 117 of file NGrid.h.

Referenced by Map::RemoveFromActive().

void decUnloadActiveLock()
Definition: NGrid.h:44
GridInfo i_GridInfo
Definition: NGrid.h:149
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
uint32 NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetGridId ( void  ) const
inline

Definition at line 97 of file NGrid.h.

97 { return i_gridId; }
uint32 i_gridId
Definition: NGrid.h:148
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
GridInfo* NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::getGridInfoRef ( )
inline

Definition at line 111 of file NGrid.h.

Referenced by Map::ProcessRelocationNotifies().

111 { return &i_GridInfo; }
GridInfo i_GridInfo
Definition: NGrid.h:149
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
grid_state_t NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetGridState ( void  ) const
inline

Definition at line 99 of file NGrid.h.

Referenced by Map::DelayedUpdate(), Map::EnsureGridLoadedForActiveObject(), and Map::ProcessRelocationNotifies().

99 { return i_cellstate; }
grid_state_t i_cellstate
Definition: NGrid.h:153
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
GridType& NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetGridType ( const uint32  x,
const uint32  y 
)
inline

Definition at line 85 of file NGrid.h.

References ASSERT.

Referenced by Map::AddToGrid(), and Map::EnsureGridLoaded().

86  {
87  ASSERT(x < N && y < N);
88  return i_cells[x][y];
89  }
GridType i_cells[N][N]
Definition: NGrid.h:154
#define ASSERT
Definition: Errors.h:29
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
GridType const& NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetGridType ( const uint32  x,
const uint32  y 
) const
inline

Definition at line 91 of file NGrid.h.

References ASSERT.

92  {
93  ASSERT(x < N && y < N);
94  return i_cells[x][y];
95  }
GridType i_cells[N][N]
Definition: NGrid.h:154
#define ASSERT
Definition: Errors.h:29
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
const TimeTracker& NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::getTimeTracker ( ) const
inline

Definition at line 112 of file NGrid.h.

112 { return i_GridInfo.getTimeTracker(); }
const TimeTracker & getTimeTracker() const
Definition: NGrid.h:39
GridInfo i_GridInfo
Definition: NGrid.h:149
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
bool NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::getUnloadLock ( ) const
inline

Definition at line 113 of file NGrid.h.

113 { return i_GridInfo.getUnloadLock(); }
bool getUnloadLock() const
Definition: NGrid.h:40
GridInfo i_GridInfo
Definition: NGrid.h:149
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
template<class T >
uint32 NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetWorldObjectCountInNGrid ( ) const
inline

Definition at line 138 of file NGrid.h.

Referenced by Map::UnloadGrid(), and ActiveState::Update().

139  {
140  uint32 count = 0;
141  for (uint32 x = 0; x < N; ++x)
142  for (uint32 y = 0; y < N; ++y)
143  count += i_cells[x][y].template GetWorldObjectCountInGrid<T>();
144  return count;
145  }
GridType i_cells[N][N]
Definition: NGrid.h:154
ACE_UINT32 uint32
Definition: Define.h:71
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
int32 NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::getX ( ) const
inline
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
int32 NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::getY ( ) const
inline
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
void NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::incUnloadActiveLock ( )
inline

Definition at line 116 of file NGrid.h.

Referenced by Map::AddToActive().

void incUnloadActiveLock()
Definition: NGrid.h:43
GridInfo i_GridInfo
Definition: NGrid.h:149
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
bool NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::isGridObjectDataLoaded ( ) const
inline

Definition at line 108 of file NGrid.h.

Referenced by Map::AddToGrid().

108 { return i_GridObjectDataLoaded; }
bool i_GridObjectDataLoaded
Definition: NGrid.h:155
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
void NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::link ( GridRefManager< NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES > > *  pTo)
inline

Definition at line 104 of file NGrid.h.

Referenced by Map::buildNGridLinkage().

105  {
106  i_Reference.link(pTo, this);
107  }
GridReference< NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES > > i_Reference
Definition: NGrid.h:150
void link(TO *toObj, FROM *fromObj)
Definition: Reference.h:42
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
void NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::ResetTimeTracker ( time_t  interval)
inline

Definition at line 118 of file NGrid.h.

Referenced by Map::ResetGridExpiry().

118 { i_GridInfo.ResetTimeTracker(interval); }
void ResetTimeTracker(time_t interval)
Definition: NGrid.h:47
GridInfo i_GridInfo
Definition: NGrid.h:149
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
void NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::SetGridId ( const uint32  id) const
inline

Definition at line 98 of file NGrid.h.

98 { i_gridId = id; }
uint32 i_gridId
Definition: NGrid.h:148
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
void NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::setGridObjectDataLoaded ( bool  pLoaded)
inline

Definition at line 109 of file NGrid.h.

109 { i_GridObjectDataLoaded = pLoaded; }
bool i_GridObjectDataLoaded
Definition: NGrid.h:155
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
void NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::SetGridState ( grid_state_t  s)
inline

Definition at line 100 of file NGrid.h.

Referenced by Map::EnsureGridCreated(), Map::EnsureGridLoadedForActiveObject(), ActiveState::Update(), and IdleState::Update().

100 { i_cellstate = s; }
grid_state_t i_cellstate
Definition: NGrid.h:153
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
void NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::setUnloadExplicitLock ( bool  on)
inline

Definition at line 114 of file NGrid.h.

void setUnloadExplicitLock(bool on)
Definition: NGrid.h:41
GridInfo i_GridInfo
Definition: NGrid.h:149
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
void NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::setUnloadReferenceLock ( bool  on)
inline

Definition at line 115 of file NGrid.h.

void setUnloadReferenceLock(bool on)
Definition: NGrid.h:42
GridInfo i_GridInfo
Definition: NGrid.h:149
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
void NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::UpdateTimeTracker ( time_t  diff)
inline

Definition at line 119 of file NGrid.h.

119 { i_GridInfo.UpdateTimeTracker(diff); }
void UpdateTimeTracker(time_t diff)
Definition: NGrid.h:48
GridInfo i_GridInfo
Definition: NGrid.h:149
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
template<class T , class TT >
void NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::VisitAllGrids ( TypeContainerVisitor< T, TypeMapContainer< TT > > &  visitor)
inline

Definition at line 123 of file NGrid.h.

Referenced by Map::UnloadGrid(), and ActiveState::Update().

124  {
125  for (uint32 x = 0; x < N; ++x)
126  for (uint32 y = 0; y < N; ++y)
127  GetGridType(x, y).Visit(visitor);
128  }
GridType & GetGridType(const uint32 x, const uint32 y)
Definition: NGrid.h:85
void Visit(TypeContainerVisitor< T, TypeMapContainer< GRID_OBJECT_TYPES > > &visitor)
Definition: Grid.h:88
ACE_UINT32 uint32
Definition: Define.h:71
template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
template<class T , class TT >
void NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::VisitGrid ( const uint32  x,
const uint32  y,
TypeContainerVisitor< T, TypeMapContainer< TT > > &  visitor 
)
inline

Definition at line 132 of file NGrid.h.

133  {
134  GetGridType(x, y).Visit(visitor);
135  }
GridType & GetGridType(const uint32 x, const uint32 y)
Definition: NGrid.h:85
void Visit(TypeContainerVisitor< T, TypeMapContainer< GRID_OBJECT_TYPES > > &visitor)
Definition: Grid.h:88

Member Data Documentation

template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
GridType NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::i_cells[N][N]
private

Definition at line 154 of file NGrid.h.

template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
grid_state_t NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::i_cellstate
private

Definition at line 153 of file NGrid.h.

template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
uint32 NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::i_gridId
private

Definition at line 148 of file NGrid.h.

template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
GridInfo NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::i_GridInfo
private

Definition at line 149 of file NGrid.h.

template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
bool NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::i_GridObjectDataLoaded
private

Definition at line 155 of file NGrid.h.

template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
GridReference<NGrid<N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> > NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::i_Reference
private

Definition at line 150 of file NGrid.h.

template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
int32 NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::i_x
private

Definition at line 151 of file NGrid.h.

template<uint32 N, class ACTIVE_OBJECT , class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
int32 NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::i_y
private

Definition at line 152 of file NGrid.h.


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