AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES > Class Template Reference

#include "MapGrid.h"

Public Types

typedef GridCell< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES > GridCellType
 

Public Member Functions

 MapGrid (uint16 const x, uint16 const y)
 
uint32 GetId () const
 
uint16 GetX () const
 
uint16 GetY () const
 
bool IsObjectDataLoaded () const
 
void SetObjectDataLoaded ()
 
template<class SPECIFIC_OBJECT >
void AddWorldObject (uint16 const x, uint16 const y, SPECIFIC_OBJECT *obj)
 
template<class SPECIFIC_OBJECT >
void RemoveWorldObject (uint16 const x, uint16 const y, SPECIFIC_OBJECT *obj)
 
template<class SPECIFIC_OBJECT >
void AddGridObject (uint16 const x, uint16 const y, SPECIFIC_OBJECT *obj)
 
template<class SPECIFIC_OBJECT >
void RemoveGridObject (uint16 const x, uint16 const y, SPECIFIC_OBJECT *obj)
 
template<class T , class TT >
void VisitAllCells (TypeContainerVisitor< T, TypeMapContainer< TT > > &visitor)
 
template<class T , class TT >
void VisitCell (uint16 const x, uint16 const y, TypeContainerVisitor< T, TypeMapContainer< TT > > &visitor)
 
void link (GridRefMgr< MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES > > *pTo)
 
GridTerrainDataGetTerrainData () const
 
std::shared_ptr< GridTerrainDataGetTerrainDataSharedPtr ()
 
void SetTerrainData (std::shared_ptr< GridTerrainData > terrainData)
 
uint32 GetCreatedCellsCount ()
 

Private Member Functions

GridCellTypeGetOrCreateCell (uint16 const x, uint16 const y)
 
GridCellTypeGetCell (uint16 const x, uint16 const y)
 
GridCellType const * GetCell (uint16 const x, uint16 const y) const
 

Private Attributes

uint16 _x
 
uint16 _y
 
bool _objectDataLoaded
 
std::array< std::array< std::unique_ptr< GridCellType >, MAX_NUMBER_OF_CELLS >, MAX_NUMBER_OF_CELLS_cells
 
GridReference< MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES > > _gridReference
 
std::shared_ptr< GridTerrainData_terrainData
 

Detailed Description

template<class WORLD_OBJECT_TYPES, class GRID_OBJECT_TYPES>
class MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >

Member Typedef Documentation

◆ GridCellType

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
typedef GridCell<WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GridCellType

Constructor & Destructor Documentation

◆ MapGrid()

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::MapGrid ( uint16 const  x,
uint16 const  y 
)
inline
37 : _x(x), _y(y), _objectDataLoaded(false), _terrainData(nullptr) { }
bool _objectDataLoaded
Definition MapGrid.h:146
std::shared_ptr< GridTerrainData > _terrainData
Definition MapGrid.h:151
uint16 _y
Definition MapGrid.h:144
uint16 _x
Definition MapGrid.h:143

Member Function Documentation

◆ AddGridObject()

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
template<class SPECIFIC_OBJECT >
void MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::AddGridObject ( uint16 const  x,
uint16 const  y,
SPECIFIC_OBJECT *  obj 
)
inline

◆ AddWorldObject()

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
template<class SPECIFIC_OBJECT >
void MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::AddWorldObject ( uint16 const  x,
uint16 const  y,
SPECIFIC_OBJECT *  obj 
)
inline

◆ GetCell() [1/2]

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
GridCellType * MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetCell ( uint16 const  x,
uint16 const  y 
)
inlineprivate
132 {
134 return _cells[x][y].get();
135 }
#define ASSERT
Definition Errors.h:68
#define MAX_NUMBER_OF_CELLS
Definition MapDefines.h:25
std::array< std::array< std::unique_ptr< GridCellType >, MAX_NUMBER_OF_CELLS >, MAX_NUMBER_OF_CELLS > _cells
Definition MapGrid.h:147

References MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::_cells, ASSERT, and MAX_NUMBER_OF_CELLS.

Referenced by MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetOrCreateCell(), and MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::VisitCell().

◆ GetCell() [2/2]

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
GridCellType const * MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetCell ( uint16 const  x,
uint16 const  y 
) const
inlineprivate

◆ GetCreatedCellsCount()

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
uint32 MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetCreatedCellsCount ( )
inline
105 {
106 uint32 count = 0;
107 for (auto& cellX : _cells)
108 {
109 for (auto& cellY : cellX)
110 {
111 if (!cellY)
112 continue;
113
114 ++count;
115 }
116 }
117 return count;
118 }
std::uint32_t uint32
Definition Define.h:107

References MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::_cells.

Referenced by MapGridManager::GetCreatedCellsInGridCount().

◆ GetId()

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
uint32 MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetId ( ) const
inline

◆ GetOrCreateCell()

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
GridCellType & MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetOrCreateCell ( uint16 const  x,
uint16 const  y 
)
inlineprivate

◆ GetTerrainData()

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
GridTerrainData * MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetTerrainData ( ) const
inline

◆ GetTerrainDataSharedPtr()

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
std::shared_ptr< GridTerrainData > MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetTerrainDataSharedPtr ( )
inline

◆ GetX()

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
uint16 MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetX ( ) const
inline

◆ GetY()

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
uint16 MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetY ( ) const
inline

◆ IsObjectDataLoaded()

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
bool MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::IsObjectDataLoaded ( ) const
inline

◆ link()

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
void MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::link ( GridRefMgr< MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES > > *  pTo)
inline
96 {
97 _gridReference.link(pTo, this);
98 }
GridReference< MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES > > _gridReference
Definition MapGrid.h:148
void link(TO *toObj, FROM *fromObj)
Definition Reference.h:45

References MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::_gridReference, and Reference< TO, FROM >::link().

◆ RemoveGridObject()

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
template<class SPECIFIC_OBJECT >
void MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::RemoveGridObject ( uint16 const  x,
uint16 const  y,
SPECIFIC_OBJECT *  obj 
)
inline
64 {
65 GetOrCreateCell(x, y).RemoveGridObject(obj);
66 }

References MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetOrCreateCell().

◆ RemoveWorldObject()

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
template<class SPECIFIC_OBJECT >
void MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::RemoveWorldObject ( uint16 const  x,
uint16 const  y,
SPECIFIC_OBJECT *  obj 
)
inline
54 {
55 GetOrCreateCell(x, y).RemoveWorldObject(obj);
56 }

References MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetOrCreateCell().

◆ SetObjectDataLoaded()

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
void MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::SetObjectDataLoaded ( )
inline

◆ SetTerrainData()

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
void MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::SetTerrainData ( std::shared_ptr< GridTerrainData terrainData)
inline

◆ VisitAllCells()

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
template<class T , class TT >
void MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::VisitAllCells ( TypeContainerVisitor< T, TypeMapContainer< TT > > &  visitor)
inline
71 {
72 for (auto& cellX : _cells)
73 {
74 for (auto& cellY : cellX)
75 {
76 if (!cellY)
77 continue;
78
79 cellY->Visit(visitor);
80 }
81 }
82 }

References MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::_cells.

Referenced by MapGridManager::UnloadGrid().

◆ VisitCell()

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
template<class T , class TT >
void MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::VisitCell ( uint16 const  x,
uint16 const  y,
TypeContainerVisitor< T, TypeMapContainer< TT > > &  visitor 
)
inline
87 {
88 GridCellType* gridCell = GetCell(x, y);
89 if (!gridCell)
90 return;
91
92 gridCell->Visit(visitor);
93 }
void Visit(TypeContainerVisitor< T, TypeMapContainer< GRID_OBJECT_TYPES > > &visitor)
Definition GridCell.h:60

References MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetCell(), and GridCell< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::Visit().

Referenced by Map::Visit().

Member Data Documentation

◆ _cells

◆ _gridReference

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
GridReference<MapGrid<WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> > MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::_gridReference
private

◆ _objectDataLoaded

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
bool MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::_objectDataLoaded
private

◆ _terrainData

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
std::shared_ptr<GridTerrainData> MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::_terrainData
private

◆ _x

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
uint16 MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::_x
private

◆ _y

template<class WORLD_OBJECT_TYPES , class GRID_OBJECT_TYPES >
uint16 MapGrid< WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::_y
private

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