[6982] Implemented gmlevel-based command security
[getmangos.git] / src / game / ObjectGridLoader.h
blob1590ba5c2026a4590311f9c82fb3a29b612b3a9f
1 /*
2 * Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef MANGOS_OBJECTGRIDLOADER_H
20 #define MANGOS_OBJECTGRIDLOADER_H
22 #include "Utilities/TypeList.h"
23 #include "Platform/Define.h"
24 #include "GameSystem/GridLoader.h"
25 #include "GridDefines.h"
26 #include "Cell.h"
28 class ObjectWorldLoader;
30 class MANGOS_DLL_DECL ObjectGridLoader
32 friend class ObjectWorldLoader;
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)
39 void Load(GridType &grid);
40 void Visit(GameObjectMapType &m);
41 void Visit(CreatureMapType &m);
42 void Visit(CorpseMapType &) {}
44 void Visit(DynamicObjectMapType&) { }
46 void LoadN(void);
48 private:
49 Cell i_cell;
50 NGridType &i_grid;
51 Map* i_map;
52 uint32 i_gameObjects;
53 uint32 i_creatures;
54 uint32 i_corpses;
57 class MANGOS_DLL_DECL ObjectGridUnloader
59 public:
60 ObjectGridUnloader(NGridType &grid) : i_grid(grid) {}
62 void MoveToRespawnN();
63 void UnloadN()
65 for(unsigned int x=0; x < MAX_NUMBER_OF_CELLS; ++x)
67 for(unsigned int y=0; y < MAX_NUMBER_OF_CELLS; ++y)
69 GridLoader<Player, AllWorldObjectTypes, AllGridObjectTypes> loader;
70 loader.Unload(i_grid(x, y), *this);
75 void Unload(GridType &grid);
76 template<class T> void Visit(GridRefManager<T> &m);
77 private:
78 NGridType &i_grid;
81 class MANGOS_DLL_DECL ObjectGridStoper
83 public:
84 ObjectGridStoper(NGridType &grid) : i_grid(grid) {}
86 void MoveToRespawnN();
87 void StopN()
89 for(unsigned int x=0; x < MAX_NUMBER_OF_CELLS; ++x)
91 for(unsigned int y=0; y < MAX_NUMBER_OF_CELLS; ++y)
93 GridLoader<Player, AllWorldObjectTypes, AllGridObjectTypes> loader;
94 loader.Stop(i_grid(x, y), *this);
99 void Stop(GridType &grid);
100 void Visit(CreatureMapType &m);
102 template<class NONACTIVE> void Visit(GridRefManager<NONACTIVE> &) {}
103 private:
104 NGridType &i_grid;
107 typedef GridLoader<Player, AllWorldObjectTypes, AllGridObjectTypes> GridLoaderType;
108 #endif