summaryrefslogtreecommitdiff
path: root/src/server/game/Grids/ObjectGridLoader.cpp
diff options
context:
space:
mode:
authorKargatum <dowlandtop@yandex.com>2020-10-12 15:08:15 +0700
committerGitHub <noreply@github.com>2020-10-12 10:08:15 +0200
commita2b26272d28f137473c4e14841da0f042e3e8bdc (patch)
tree43a44857f92affd0ffd220a2fc09951e6ddd3f92 /src/server/game/Grids/ObjectGridLoader.cpp
parente99b526e17ce628e919347dff4c150cd6645d01b (diff)
refactor(Core/Game): restyle game lib with astyle (#3466)
Diffstat (limited to 'src/server/game/Grids/ObjectGridLoader.cpp')
-rw-r--r--src/server/game/Grids/ObjectGridLoader.cpp72
1 files changed, 37 insertions, 35 deletions
diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp
index fc183b33f1..744021cedb 100644
--- a/src/server/game/Grids/ObjectGridLoader.cpp
+++ b/src/server/game/Grids/ObjectGridLoader.cpp
@@ -21,21 +21,21 @@
//TODO: to implement npc on transport, also need to load npcs at grid loading
class ObjectWorldLoader
{
- public:
- explicit ObjectWorldLoader(ObjectGridLoader& gloader)
- : i_cell(gloader.i_cell), i_map(gloader.i_map), i_grid(gloader.i_grid), i_corpses (0)
- {}
+public:
+ explicit ObjectWorldLoader(ObjectGridLoader& gloader)
+ : i_cell(gloader.i_cell), i_map(gloader.i_map), i_grid(gloader.i_grid), i_corpses (0)
+ {}
- void Visit(CorpseMapType &m);
+ void Visit(CorpseMapType& m);
- template<class T> void Visit(GridRefManager<T>&) { }
+ template<class T> void Visit(GridRefManager<T>&) { }
- private:
- Cell i_cell;
- Map* i_map;
- public:
- NGridType &i_grid;
- uint32 i_corpses;
+private:
+ Cell i_cell;
+ Map* i_map;
+public:
+ NGridType& i_grid;
+ uint32 i_corpses;
};
template<class T> void ObjectGridLoader::SetObjectCell(T* /*obj*/, CellCoord const& /*cellCoord*/)
@@ -55,7 +55,7 @@ template<> void ObjectGridLoader::SetObjectCell(GameObject* obj, CellCoord const
}
template <class T>
-void AddObjectHelper(CellCoord &cell, GridRefManager<T> &m, uint32 &count, Map* /*map*/, T *obj)
+void AddObjectHelper(CellCoord& cell, GridRefManager<T>& m, uint32& count, Map* /*map*/, T* obj)
{
obj->AddToGrid(m);
ObjectGridLoader::SetObjectCell(obj, cell);
@@ -64,7 +64,7 @@ void AddObjectHelper(CellCoord &cell, GridRefManager<T> &m, uint32 &count, Map*
}
template <>
-void AddObjectHelper(CellCoord &cell, CreatureMapType &m, uint32 &count, Map* map, Creature *obj)
+void AddObjectHelper(CellCoord& cell, CreatureMapType& m, uint32& count, Map* map, Creature* obj)
{
obj->AddToGrid(m);
ObjectGridLoader::SetObjectCell(obj, cell);
@@ -76,7 +76,7 @@ void AddObjectHelper(CellCoord &cell, CreatureMapType &m, uint32 &count, Map* ma
}
template <>
-void AddObjectHelper(CellCoord &cell, GameObjectMapType &m, uint32 &count, Map* map, GameObject *obj)
+void AddObjectHelper(CellCoord& cell, GameObjectMapType& m, uint32& count, Map* map, GameObject* obj)
{
obj->AddToGrid(m);
ObjectGridLoader::SetObjectCell(obj, cell);
@@ -88,7 +88,7 @@ void AddObjectHelper(CellCoord &cell, GameObjectMapType &m, uint32 &count, Map*
}
template <class T>
-void LoadHelper(CellGuidSet const& guid_set, CellCoord &cell, GridRefManager<T> &m, uint32 &count, Map* map)
+void LoadHelper(CellGuidSet const& guid_set, CellCoord& cell, GridRefManager<T>& m, uint32& count, Map* map)
{
for (CellGuidSet::const_iterator i_guid = guid_set.begin(); i_guid != guid_set.end(); ++i_guid)
{
@@ -106,7 +106,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellCoord &cell, GridRefManager<T>
}
template <>
-void LoadHelper(CellGuidSet const& guid_set, CellCoord &cell, GridRefManager<GameObject> &m, uint32 &count, Map* map)
+void LoadHelper(CellGuidSet const& guid_set, CellCoord& cell, GridRefManager<GameObject>& m, uint32& count, Map* map)
{
for (CellGuidSet::const_iterator i_guid = guid_set.begin(); i_guid != guid_set.end(); ++i_guid)
{
@@ -124,7 +124,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellCoord &cell, GridRefManager<Gam
}
}
-void LoadHelper(CellCorpseSet const& cell_corpses, CellCoord &cell, CorpseMapType &m, uint32 &count, Map* map)
+void LoadHelper(CellCorpseSet const& cell_corpses, CellCoord& cell, CorpseMapType& m, uint32& count, Map* map)
{
if (cell_corpses.empty())
return;
@@ -156,21 +156,21 @@ void LoadHelper(CellCorpseSet const& cell_corpses, CellCoord &cell, CorpseMapTyp
}
}
-void ObjectGridLoader::Visit(GameObjectMapType &m)
+void ObjectGridLoader::Visit(GameObjectMapType& m)
{
CellCoord cellCoord = i_cell.GetCellCoord();
CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cellCoord.GetId());
LoadHelper(cell_guids.gameobjects, cellCoord, m, i_gameObjects, i_map);
}
-void ObjectGridLoader::Visit(CreatureMapType &m)
+void ObjectGridLoader::Visit(CreatureMapType& m)
{
CellCoord cellCoord = i_cell.GetCellCoord();
CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cellCoord.GetId());
LoadHelper(cell_guids.creatures, cellCoord, m, i_creatures, i_map);
}
-void ObjectWorldLoader::Visit(CorpseMapType &m)
+void ObjectWorldLoader::Visit(CorpseMapType& m)
{
CellCoord cellCoord = i_cell.GetCellCoord();
// corpses are always added to spawn mode 0 and they are spawned by their instance id
@@ -180,12 +180,14 @@ void ObjectWorldLoader::Visit(CorpseMapType &m)
void ObjectGridLoader::LoadN(void)
{
- i_gameObjects = 0; i_creatures = 0; i_corpses = 0;
+ i_gameObjects = 0;
+ i_creatures = 0;
+ i_corpses = 0;
i_cell.data.Part.cell_y = 0;
- for (unsigned int x=0; x < MAX_NUMBER_OF_CELLS; ++x)
+ for (unsigned int x = 0; x < MAX_NUMBER_OF_CELLS; ++x)
{
i_cell.data.Part.cell_x = x;
- for (unsigned int y=0; y < MAX_NUMBER_OF_CELLS; ++y)
+ for (unsigned int y = 0; y < MAX_NUMBER_OF_CELLS; ++y)
{
i_cell.data.Part.cell_y = y;
@@ -210,11 +212,11 @@ void ObjectGridLoader::LoadN(void)
}
template<class T>
-void ObjectGridUnloader::Visit(GridRefManager<T> &m)
+void ObjectGridUnloader::Visit(GridRefManager<T>& m)
{
while (!m.isEmpty())
{
- T *obj = m.getFirst()->GetSource();
+ T* obj = m.getFirst()->GetSource();
// if option set then object already saved at this moment
//if (!sWorld->getBoolConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
// obj->SaveRespawnTime();
@@ -229,17 +231,17 @@ void ObjectGridUnloader::Visit(GridRefManager<T> &m)
}
template<class T>
-void ObjectGridCleaner::Visit(GridRefManager<T> &m)
+void ObjectGridCleaner::Visit(GridRefManager<T>& m)
{
for (typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
iter->GetSource()->CleanupsBeforeDelete();
}
-template void ObjectGridUnloader::Visit(CreatureMapType &);
-template void ObjectGridUnloader::Visit(GameObjectMapType &);
-template void ObjectGridUnloader::Visit(DynamicObjectMapType &);
-template void ObjectGridUnloader::Visit(CorpseMapType &);
-template void ObjectGridCleaner::Visit(CreatureMapType &);
-template void ObjectGridCleaner::Visit<GameObject>(GameObjectMapType &);
-template void ObjectGridCleaner::Visit<DynamicObject>(DynamicObjectMapType &);
-template void ObjectGridCleaner::Visit<Corpse>(CorpseMapType &);
+template void ObjectGridUnloader::Visit(CreatureMapType&);
+template void ObjectGridUnloader::Visit(GameObjectMapType&);
+template void ObjectGridUnloader::Visit(DynamicObjectMapType&);
+template void ObjectGridUnloader::Visit(CorpseMapType&);
+template void ObjectGridCleaner::Visit(CreatureMapType&);
+template void ObjectGridCleaner::Visit<GameObject>(GameObjectMapType&);
+template void ObjectGridCleaner::Visit<DynamicObject>(DynamicObjectMapType&);
+template void ObjectGridCleaner::Visit<Corpse>(CorpseMapType&);