AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
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 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
 

Detailed Description

Constructor & Destructor Documentation

◆ ObjectGridLoader()

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

Member Function Documentation

◆ LoadN()

void ObjectGridLoader::LoadN ( void  )
184{
185 i_gameObjects = 0;
186 i_creatures = 0;
187 i_corpses = 0;
189 for (uint32 x = 0; x < MAX_NUMBER_OF_CELLS; ++x)
190 {
192 for (uint32 y = 0; y < MAX_NUMBER_OF_CELLS; ++y)
193 {
195
196 //Load creatures and game objects
197 {
199 i_grid.VisitGrid(x, y, visitor);
200 }
201
202 //Load corpses (not bones)
203 {
204 ObjectWorldLoader worker(*this);
206 i_grid.VisitGrid(x, y, visitor);
207 }
208 }
209 }
210 LOG_DEBUG("maps", "{} GameObjects, {} Creatures, and {} Corpses/Bones loaded for grid {} on map {}", i_gameObjects, i_creatures, i_corpses, i_grid.GetGridId(), i_map->GetId());
211}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:168
std::uint32_t uint32
Definition: Define.h:107
#define MAX_NUMBER_OF_CELLS
Definition: GridDefines.h:35
Definition: TypeContainerVisitor.h:84
union Cell::@289 data
unsigned cell_y
Definition: Cell.h:99
struct Cell::@289::@290 Part
unsigned cell_x
Definition: Cell.h:98
uint32 GetGridId() const
Definition: NGrid.h:57
void VisitGrid(const uint32 x, const uint32 y, TypeContainerVisitor< T, TypeMapContainer< TT > > &visitor)
Definition: NGrid.h:101
Definition: ObjectGridLoader.cpp:32
uint32 GetId() const
Definition: Map.h:379

References Cell::cell_x, Cell::cell_y, Cell::data, NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetGridId(), Map::GetId(), i_cell, i_corpses, i_creatures, i_gameObjects, i_grid, i_map, LOG_DEBUG, MAX_NUMBER_OF_CELLS, Cell::Part, and NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::VisitGrid().

Referenced by Map::EnsureGridLoaded().

◆ SetObjectCell() [1/3]

template<>
void ObjectGridLoader::SetObjectCell ( Creature obj,
CellCoord const &  cellCoord 
)
55{
56 Cell cell(cellCoord);
57 obj->SetCurrentCell(cell);
58}
void SetCurrentCell(Cell const &cell)
Definition: Object.h:398
Definition: Cell.h:46

References MovableMapObject::SetCurrentCell().

◆ SetObjectCell() [2/3]

template<>
void ObjectGridLoader::SetObjectCell ( GameObject obj,
CellCoord const &  cellCoord 
)
61{
62 Cell cell(cellCoord);
63 obj->SetCurrentCell(cell);
64}

References MovableMapObject::SetCurrentCell().

◆ SetObjectCell() [3/3]

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

Referenced by AddObjectHelper().

◆ Visit() [1/4]

void ObjectGridLoader::Visit ( CorpseMapType ) const
inline
40{}

◆ Visit() [2/4]

void ObjectGridLoader::Visit ( CreatureMapType m)
158{
159 CellCoord cellCoord = i_cell.GetCellCoord();
160 CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cellCoord.GetId());
161 LoadHelper(cell_guids.creatures, cellCoord, m, i_creatures, i_map);
162}
#define sObjectMgr
Definition: ObjectMgr.h:1623
void LoadHelper(CellGuidSet const &, CellCoord &, GridRefMgr< T > &, uint32 &, Map *)
Definition: ObjectGridLoader.cpp:100
Definition: ObjectMgr.h:479
CellGuidSet creatures
Definition: ObjectMgr.h:480
CellCoord GetCellCoord() const
Definition: Cell.h:77
uint32 GetId() const
Definition: GridDefines.h:148
uint8 GetSpawnMode() const
Definition: Map.h:420

References CellObjectGuids::creatures, Cell::GetCellCoord(), CoordPair< LIMIT >::GetId(), Map::GetId(), Map::GetSpawnMode(), i_cell, i_creatures, i_map, LoadHelper(), and sObjectMgr.

◆ Visit() [3/4]

void ObjectGridLoader::Visit ( DynamicObjectMapType ) const
inline
41{}

◆ Visit() [4/4]

void ObjectGridLoader::Visit ( GameObjectMapType m)
151{
152 CellCoord cellCoord = i_cell.GetCellCoord();
153 CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cellCoord.GetId());
154 LoadHelper(cell_guids.gameobjects, cellCoord, m, i_gameObjects, i_map);
155}
CellGuidSet gameobjects
Definition: ObjectMgr.h:481

References CellObjectGuids::gameobjects, Cell::GetCellCoord(), CoordPair< LIMIT >::GetId(), Map::GetId(), Map::GetSpawnMode(), i_cell, i_gameObjects, i_map, LoadHelper(), and sObjectMgr.

Friends And Related Function Documentation

◆ ObjectWorldLoader

friend class ObjectWorldLoader
friend

Member Data Documentation

◆ i_cell

Cell ObjectGridLoader::i_cell
private

Referenced by LoadN(), and Visit().

◆ i_corpses

uint32 ObjectGridLoader::i_corpses
private

Referenced by LoadN().

◆ i_creatures

uint32 ObjectGridLoader::i_creatures
private

Referenced by LoadN(), and Visit().

◆ i_gameObjects

uint32 ObjectGridLoader::i_gameObjects
private

Referenced by LoadN(), and Visit().

◆ i_grid

NGridType& ObjectGridLoader::i_grid
private

Referenced by LoadN().

◆ i_map

Map* ObjectGridLoader::i_map
private

Referenced by LoadN(), and Visit().