root/trunk/src/game/ObjectGridLoader.h @ 143

Revision 102, 3.2 kB (checked in by yumileroy, 17 years ago)

[svn] Fixed copyright notices to comply with GPL.

Original author: w12x
Date: 2008-10-23 03:29:52-05:00

Line 
1/*
2 * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
3 *
4 * Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef TRINITY_OBJECTGRIDLOADER_H
22#define TRINITY_OBJECTGRIDLOADER_H
23
24#include "Utilities/TypeList.h"
25#include "Platform/Define.h"
26#include "GameSystem/GridLoader.h"
27#include "GridDefines.h"
28#include "Cell.h"
29
30class ObjectWorldLoader;
31
32class TRINITY_DLL_DECL ObjectGridLoader
33{
34    friend class ObjectWorldLoader;
35
36    public:
37        ObjectGridLoader(NGridType &grid, Map* map, const Cell &cell)
38            : i_cell(cell), i_grid(grid), i_map(map), i_gameObjects(0), i_creatures(0), i_corpses (0)
39            {}
40
41        void Load(GridType &grid);
42        void Visit(GameObjectMapType &m);
43        void Visit(CreatureMapType &m);
44        void Visit(CorpseMapType &) {}
45
46        void Visit(DynamicObjectMapType&) { }
47
48        void LoadN(void);
49
50    private:
51        Cell i_cell;
52        NGridType &i_grid;
53        Map* i_map;
54        uint32 i_gameObjects;
55        uint32 i_creatures;
56        uint32 i_corpses;
57};
58
59class TRINITY_DLL_DECL ObjectGridUnloader
60{
61    public:
62        ObjectGridUnloader(NGridType &grid) : i_grid(grid) {}
63
64        void MoveToRespawnN();
65        void UnloadN()
66        {
67            for(unsigned int x=0; x < MAX_NUMBER_OF_CELLS; ++x)
68            {
69                for(unsigned int y=0; y < MAX_NUMBER_OF_CELLS; ++y)
70                {
71                    GridLoader<Player, AllWorldObjectTypes, AllGridObjectTypes> loader;
72                    loader.Unload(i_grid(x, y), *this);
73                }
74            }
75        }
76
77        void Unload(GridType &grid);
78        template<class T> void Visit(GridRefManager<T> &m);
79    private:
80        NGridType &i_grid;
81};
82
83class TRINITY_DLL_DECL ObjectGridStoper
84{
85    public:
86        ObjectGridStoper(NGridType &grid) : i_grid(grid) {}
87
88        void MoveToRespawnN();
89        void StopN()
90        {
91            for(unsigned int x=0; x < MAX_NUMBER_OF_CELLS; ++x)
92            {
93                for(unsigned int y=0; y < MAX_NUMBER_OF_CELLS; ++y)
94                {
95                    GridLoader<Player, AllWorldObjectTypes, AllGridObjectTypes> loader;
96                    loader.Stop(i_grid(x, y), *this);
97                }
98            }
99        }
100
101        void Stop(GridType &grid);
102        void Visit(CreatureMapType &m);
103
104        template<class NONACTIVE> void Visit(GridRefManager<NONACTIVE> &) {}
105    private:
106        NGridType &i_grid;
107};
108
109typedef GridLoader<Player, AllWorldObjectTypes, AllGridObjectTypes> GridLoaderType;
110#endif
Note: See TracBrowser for help on using the browser.