TrinityCore
Loading...
Searching...
No Matches
ObjectGridLoader.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITY_OBJECT_GRID_LOADER_H
19#define TRINITY_OBJECT_GRID_LOADER_H
20
21#include "Cell.h"
22#include "Define.h"
23#include "GridDefines.h"
24#include "ObjectGuid.h"
25
26class MapObject;
27class ObjectGuid;
29
31{
32 public:
33 ObjectGridLoaderBase(NGridType& grid, Map* map, Cell const& cell)
34 : i_cell(cell), i_grid(grid), i_map(map), i_gameObjects(0), i_creatures(0), i_corpses(0), i_areaTriggers(0)
35 { }
36
37 static void SetObjectCell(MapObject* obj, CellCoord const& cellCoord);
38
39 uint32 GetLoadedCreatures() const { return i_creatures; }
40 uint32 GetLoadedGameObjects() const { return i_gameObjects; }
41 uint32 GetLoadedCorpses() const { return i_corpses; }
42 uint32 GetLoadedAreaTriggers() const { return i_areaTriggers; }
43
44 protected:
52};
53
55{
56 friend class ObjectWorldLoader;
57
58 public:
59 ObjectGridLoader(NGridType& grid, Map* map, Cell const& cell)
60 : ObjectGridLoaderBase(grid, map, cell)
61 { }
62
63 void Visit(GameObjectMapType &m);
64 void Visit(CreatureMapType &m);
65 void Visit(AreaTriggerMapType &m);
66 void Visit(CorpseMapType &) const { }
67 void Visit(DynamicObjectMapType&) const { }
68 void Visit(SceneObjectMapType&) const { }
69 void Visit(ConversationMapType&) const { }
70
71 void LoadN();
72};
73
75{
76 public:
77 PersonalPhaseGridLoader(NGridType& grid, Map* map, Cell const& cell, ObjectGuid const& phaseOwner)
78 : ObjectGridLoaderBase(grid, map, cell), _phaseId(0), _phaseOwner(phaseOwner)
79 { }
80
81 void Visit(GameObjectMapType &m);
82 void Visit(CreatureMapType &m);
83 void Visit(AreaTriggerMapType&) const { }
84 void Visit(CorpseMapType&) const { }
85 void Visit(DynamicObjectMapType&) const { }
86 void Visit(SceneObjectMapType&) const { }
87 void Visit(ConversationMapType&) const { }
88
89 void Load(uint32 phaseId);
90
91 private:
94};
95
96//Stop the creatures before unloading the NGrid
98{
99 public:
100 void Visit(CreatureMapType &m);
101 template<class T> void Visit(GridRefManager<T> &) { }
102};
103
104//Move the foreign creatures back to respawn positions before unloading the NGrid
106{
107 public:
108 void Visit(CreatureMapType &m);
109 void Visit(GameObjectMapType &m);
110 template<class T> void Visit(GridRefManager<T> &) { }
111};
112
113//Clean up and remove from world
115{
116 public:
117 template<class T> void Visit(GridRefManager<T> &);
118};
119
120//Delete objects before deleting NGrid
122{
123 public:
124 void Visit(CorpseMapType& /*m*/) { } // corpses are deleted with Map
125 template<class T> void Visit(GridRefManager<T> &m);
126};
127#endif
#define TC_GAME_API
Definition Define.h:129
uint32_t uint32
Definition Define.h:154
Definition Map.h:225
Definition NGrid.h:70
void Visit(GridRefManager< T > &)
void Visit(GridRefManager< T > &)
uint32 GetLoadedAreaTriggers() const
uint32 GetLoadedCorpses() const
uint32 GetLoadedCreatures() const
ObjectGridLoaderBase(NGridType &grid, Map *map, Cell const &cell)
uint32 GetLoadedGameObjects() const
void Visit(CorpseMapType &) const
ObjectGridLoader(NGridType &grid, Map *map, Cell const &cell)
void Visit(DynamicObjectMapType &) const
void Visit(SceneObjectMapType &) const
void Visit(ConversationMapType &) const
void Visit(GridRefManager< T > &)
void Visit(CorpseMapType &)
void Visit(ConversationMapType &) const
PersonalPhaseGridLoader(NGridType &grid, Map *map, Cell const &cell, ObjectGuid const &phaseOwner)
void Visit(CorpseMapType &) const
void Visit(DynamicObjectMapType &) const
void Visit(AreaTriggerMapType &) const
void Visit(SceneObjectMapType &) const
Definition Cell.h:47