TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ObjectGridLoader Class Reference

#include <ObjectGridLoader.h>

Public Member Functions

 ObjectGridLoader (NGridType &grid, Map *map, const Cell &cell)
 
void Visit (GameObjectMapType &m)
 
void Visit (CreatureMapType &m)
 
void Visit (CorpseMapType &) const
 
void Visit (DynamicObjectMapType &) const
 
void Visit (AreaTriggerMapType &) const
 
void LoadN (void)
 
template<>
void SetObjectCell (Creature *obj, CellCoord const &cellCoord)
 
template<>
void SetObjectCell (GameObject *obj, CellCoord const &cellCoord)
 

Static Public Member Functions

template<class T >
static void SetObjectCell (T *obj, CellCoord const &cellCoord)
 

Private Attributes

Cell i_cell
 
NGridTypei_grid
 
Mapi_map
 
uint32 i_gameObjects
 
uint32 i_creatures
 
uint32 i_corpses
 

Friends

class ObjectWorldLoader
 

Constructor & Destructor Documentation

ObjectGridLoader::ObjectGridLoader ( NGridType grid,
Map map,
const Cell cell 
)
inline
36  : i_cell(cell), i_grid(grid), i_map(map), i_gameObjects(0), i_creatures(0), i_corpses (0)
37  { }
uint32 i_gameObjects
Definition: ObjectGridLoader.h:53
Cell i_cell
Definition: ObjectGridLoader.h:50
uint32 i_creatures
Definition: ObjectGridLoader.h:54
NGridType & i_grid
Definition: ObjectGridLoader.h:51
Map * i_map
Definition: ObjectGridLoader.h:52
uint32 i_corpses
Definition: ObjectGridLoader.h:55

Member Function Documentation

void ObjectGridLoader::LoadN ( void  )
168 {
169  i_gameObjects = 0; i_creatures = 0; i_corpses = 0;
170  i_cell.data.Part.cell_y = 0;
171  for (uint32 x = 0; x < MAX_NUMBER_OF_CELLS; ++x)
172  {
173  i_cell.data.Part.cell_x = x;
174  for (uint32 y = 0; y < MAX_NUMBER_OF_CELLS; ++y)
175  {
176  i_cell.data.Part.cell_y = y;
177 
178  //Load creatures and game objects
179  {
181  i_grid.VisitGrid(x, y, visitor);
182  }
183 
184  //Load corpses (not bones)
185  {
186  ObjectWorldLoader worker(*this);
188  i_grid.VisitGrid(x, y, visitor);
189  }
190  }
191  }
192  TC_LOG_DEBUG("maps", "%u GameObjects, %u Creatures, and %u Corpses/Bones loaded for grid %u on map %u", i_gameObjects, i_creatures, i_corpses, i_grid.GetGridId(), i_map->GetId());
193 }
uint32 i_gameObjects
Definition: ObjectGridLoader.h:53
struct Cell::@307::@308 Part
Definition: TypeContainerVisitor.h:32
#define MAX_NUMBER_OF_CELLS
Definition: GridDefines.h:35
union Cell::@307 data
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
uint32 GetId(void) const
Definition: Map.h:325
Cell i_cell
Definition: ObjectGridLoader.h:50
uint32 i_creatures
Definition: ObjectGridLoader.h:54
void VisitGrid(const uint32 x, const uint32 y, TypeContainerVisitor< T, TypeMapContainer< TT > > &visitor)
Definition: NGrid.h:155
uint32_t uint32
Definition: Define.h:150
G3D::int16 y
Definition: Vector2int16.h:38
NGridType & i_grid
Definition: ObjectGridLoader.h:51
Map * i_map
Definition: ObjectGridLoader.h:52
Definition: ObjectGridLoader.cpp:62
uint32 i_corpses
Definition: ObjectGridLoader.h:55
G3D::int16 x
Definition: Vector2int16.h:37
uint32 GetGridId(void) const
Definition: NGrid.h:98

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class T >
void ObjectGridLoader::SetObjectCell ( T *  obj,
CellCoord const cellCoord 
)
static
81 { }

+ Here is the caller graph for this function:

template<>
void ObjectGridLoader::SetObjectCell ( Creature obj,
CellCoord const cellCoord 
)
84 {
85  Cell cell(cellCoord);
86  obj->SetCurrentCell(cell);
87 }
Definition: Cell.h:49
template<>
void ObjectGridLoader::SetObjectCell ( GameObject obj,
CellCoord const cellCoord 
)
90 {
91  Cell cell(cellCoord);
92  obj->SetCurrentCell(cell);
93 }
Definition: Cell.h:49
void ObjectGridLoader::Visit ( GameObjectMapType m)
135 {
136  CellCoord cellCoord = i_cell.GetCellCoord();
137  CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cellCoord.GetId());
138  LoadHelper(cell_guids.gameobjects, cellCoord, m, i_gameObjects, i_map);
139 }
uint32 i_gameObjects
Definition: ObjectGridLoader.h:53
uint8 GetSpawnMode() const
Definition: Map.h:369
void LoadHelper(CellGuidSet const &guid_set, CellCoord &cell, GridRefManager< T > &m, uint32 &count, Map *map)
Definition: ObjectGridLoader.cpp:117
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 GetId(void) const
Definition: Map.h:325
Cell i_cell
Definition: ObjectGridLoader.h:50
CellCoord GetCellCoord() const
Definition: Cell.h:81
Map * i_map
Definition: ObjectGridLoader.h:52
CellGuidSet gameobjects
Definition: ObjectMgr.h:413
Definition: ObjectMgr.h:410
uint32 GetId() const
Definition: GridDefines.h:150

+ Here is the call graph for this function:

void ObjectGridLoader::Visit ( CreatureMapType m)
142 {
143  CellCoord cellCoord = i_cell.GetCellCoord();
144  CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cellCoord.GetId());
145  LoadHelper(cell_guids.creatures, cellCoord, m, i_creatures, i_map);
146 }
uint8 GetSpawnMode() const
Definition: Map.h:369
void LoadHelper(CellGuidSet const &guid_set, CellCoord &cell, GridRefManager< T > &m, uint32 &count, Map *map)
Definition: ObjectGridLoader.cpp:117
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 GetId(void) const
Definition: Map.h:325
Cell i_cell
Definition: ObjectGridLoader.h:50
uint32 i_creatures
Definition: ObjectGridLoader.h:54
CellCoord GetCellCoord() const
Definition: Cell.h:81
Map * i_map
Definition: ObjectGridLoader.h:52
CellGuidSet creatures
Definition: ObjectMgr.h:412
Definition: ObjectMgr.h:410
uint32 GetId() const
Definition: GridDefines.h:150

+ Here is the call graph for this function:

void ObjectGridLoader::Visit ( CorpseMapType ) const
inline
41 { }
void ObjectGridLoader::Visit ( DynamicObjectMapType ) const
inline
42 { }
void ObjectGridLoader::Visit ( AreaTriggerMapType ) const
inline
43 { }

Friends And Related Function Documentation

friend class ObjectWorldLoader
friend

Member Data Documentation

Cell ObjectGridLoader::i_cell
private
uint32 ObjectGridLoader::i_corpses
private
uint32 ObjectGridLoader::i_creatures
private
uint32 ObjectGridLoader::i_gameObjects
private
NGridType& ObjectGridLoader::i_grid
private
Map* ObjectGridLoader::i_map
private

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