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 "Define.h"
22#include "GridDefines.h"
23#include "ObjectGuid.h"
24
25class Map;
26class ObjectGuid;
27
29{
30 public:
32 : i_grid(grid), i_map(map), i_gameObjects(0), i_creatures(0), i_corpses(0), i_areaTriggers(0)
33 { }
34
35 uint32 GetLoadedCreatures() const { return i_creatures; }
36 uint32 GetLoadedGameObjects() const { return i_gameObjects; }
37 uint32 GetLoadedCorpses() const { return i_corpses; }
38 uint32 GetLoadedAreaTriggers() const { return i_areaTriggers; }
39
40 template <typename T>
41 static void AddToMap(T* obj, Map* map, uint32& objectCount);
42
43 protected:
50};
51
53{
54 public:
56 : ObjectGridLoaderBase(grid, map)
57 { }
58
59 void LoadN();
60};
61
63{
64 public:
65 PersonalPhaseGridLoader(NGridType& grid, Map* map, ObjectGuid const& phaseOwner)
66 : ObjectGridLoaderBase(grid, map), _phaseOwner(phaseOwner)
67 { }
68
69 void Load(uint32 phaseId);
70
71 private:
73};
74
75//Stop the creatures before unloading the NGrid
77{
78 public:
79 void Visit(CreatureMapType &m);
80 template<class T> void Visit(GridRefManager<T> &) { }
81};
82
83//Move the foreign creatures back to respawn positions before unloading the NGrid
85{
86 public:
87 void Visit(CreatureMapType &m);
88 void Visit(GameObjectMapType &m);
89 template<class T> void Visit(GridRefManager<T> &) { }
90};
91
92//Clean up and remove from world
94{
95 public:
96 template<class T> void Visit(GridRefManager<T> &);
97};
98
99//Delete objects before deleting NGrid
101{
102 public:
103 void Visit(CorpseMapType& /*m*/) { } // corpses are deleted with Map
104 template<class T> void Visit(GridRefManager<T> &m);
105};
106#endif
#define TC_GAME_API
Definition Define.h:129
uint32_t uint32
Definition Define.h:154
Definition Map.h:227
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)
uint32 GetLoadedGameObjects() const
ObjectGridLoader(NGridType &grid, Map *map)
void Visit(GridRefManager< T > &)
void Visit(CorpseMapType &)
PersonalPhaseGridLoader(NGridType &grid, Map *map, ObjectGuid const &phaseOwner)