2 * Copyright (C) 2005-2009 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"
28 class ObjectWorldLoader
;
30 class MANGOS_DLL_DECL ObjectGridLoader
32 friend class ObjectWorldLoader
;
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
&) { }
57 class MANGOS_DLL_DECL ObjectGridUnloader
60 ObjectGridUnloader(NGridType
&grid
) : i_grid(grid
) {}
62 void MoveToRespawnN();
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
);
81 class MANGOS_DLL_DECL ObjectGridStoper
84 ObjectGridStoper(NGridType
&grid
) : i_grid(grid
) {}
86 void MoveToRespawnN();
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
> &) {}
107 typedef GridLoader
<Player
, AllWorldObjectTypes
, AllGridObjectTypes
> GridLoaderType
;