TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ObjectGridLoader.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef TRINITY_OBJECTGRIDLOADER_H
20 #define TRINITY_OBJECTGRIDLOADER_H
21 
22 #include "TypeList.h"
23 #include "Define.h"
24 #include "GridLoader.h"
25 #include "GridDefines.h"
26 #include "Cell.h"
27 
28 class ObjectWorldLoader;
29 
31 {
32  friend class ObjectWorldLoader;
33 
34  public:
35  ObjectGridLoader(NGridType &grid, Map* map, const Cell &cell)
36  : i_cell(cell), i_grid(grid), i_map(map), i_gameObjects(0), i_creatures(0), i_corpses (0)
37  { }
38 
39  void Visit(GameObjectMapType &m);
40  void Visit(CreatureMapType &m);
41  void Visit(CorpseMapType &) const { }
42  void Visit(DynamicObjectMapType&) const { }
43  void Visit(AreaTriggerMapType &) const { }
44 
45  void LoadN(void);
46 
47  template<class T> static void SetObjectCell(T* obj, CellCoord const& cellCoord);
48 
49  private:
56 };
57 
58 //Stop the creatures before unloading the NGrid
60 {
61  public:
62  void Visit(CreatureMapType &m);
63  template<class T> void Visit(GridRefManager<T> &) { }
64 };
65 
66 //Move the foreign creatures back to respawn positions before unloading the NGrid
68 {
69  public:
70  void Visit(CreatureMapType &m);
71  void Visit(GameObjectMapType &m);
72  template<class T> void Visit(GridRefManager<T> &) { }
73 };
74 
75 //Clean up and remove from world
77 {
78  public:
79  template<class T> void Visit(GridRefManager<T> &);
80 };
81 
82 //Delete objects before deleting NGrid
84 {
85  public:
86  void Visit(CorpseMapType& /*m*/) { } // corpses are deleted with Map
87  template<class T> void Visit(GridRefManager<T> &m);
88 };
89 #endif
Definition: NGrid.h:77
uint32 i_gameObjects
Definition: ObjectGridLoader.h:53
void Visit(CorpseMapType &) const
Definition: ObjectGridLoader.h:41
Map * i_map
Definition: ObjectGridLoader.cpp:75
uint32 & i_corpses
Definition: ObjectGridLoader.cpp:78
Definition: ObjectGridLoader.h:30
void Visit(GridRefManager< T > &)
Definition: ObjectGridLoader.h:63
Cell i_cell
Definition: ObjectGridLoader.h:50
Definition: ObjectGridLoader.h:59
Definition: GridReference.h:25
uint32 i_creatures
Definition: ObjectGridLoader.h:54
void Visit(CorpseMapType &)
Definition: ObjectGridLoader.h:86
Definition: ObjectGridLoader.h:76
uint32_t uint32
Definition: Define.h:150
Definition: ObjectGridLoader.h:67
ObjectGridLoader(NGridType &grid, Map *map, const Cell &cell)
Definition: ObjectGridLoader.h:35
void Visit(GridRefManager< T > &)
Definition: ObjectGridLoader.cpp:230
Definition: Map.h:259
NGridType & i_grid
Definition: ObjectGridLoader.h:51
Map * i_map
Definition: ObjectGridLoader.h:52
Definition: Cell.h:49
Definition: ObjectGridLoader.cpp:62
Definition: ObjectGridLoader.h:83
Cell i_cell
Definition: ObjectGridLoader.cpp:74
NGridType & i_grid
Definition: ObjectGridLoader.cpp:76
#define TC_GAME_API
Definition: Define.h:134
void Visit(AreaTriggerMapType &) const
Definition: ObjectGridLoader.h:43
void Visit(DynamicObjectMapType &) const
Definition: ObjectGridLoader.h:42
void Visit(CorpseMapType &m)
Definition: ObjectGridLoader.cpp:148
uint32 i_corpses
Definition: ObjectGridLoader.h:55
void Visit(GridRefManager< T > &)
Definition: ObjectGridLoader.h:72