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_GRIDSTATES_H |
---|
22 | #define TRINITY_GRIDSTATES_H |
---|
23 | |
---|
24 | #include "Map.h" |
---|
25 | |
---|
26 | class TRINITY_DLL_DECL GridState |
---|
27 | { |
---|
28 | public: |
---|
29 | #ifdef TRINITY_DEBUG |
---|
30 | #define MAGIC_TESTVAL 0xFBE823BA |
---|
31 | GridState() { i_Magic = MAGIC_TESTVAL; } |
---|
32 | bool checkMagic() |
---|
33 | { |
---|
34 | if(i_Magic != MAGIC_TESTVAL) |
---|
35 | { |
---|
36 | sLog.outError("!!! GridState: Magic value gone !!!"); |
---|
37 | return false; |
---|
38 | } |
---|
39 | return true; |
---|
40 | } |
---|
41 | void setMagic() { i_Magic = MAGIC_TESTVAL; } |
---|
42 | unsigned int i_Magic; |
---|
43 | #endif |
---|
44 | virtual void Update(Map &, NGridType&, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const = 0; |
---|
45 | }; |
---|
46 | |
---|
47 | class TRINITY_DLL_DECL InvalidState : public GridState |
---|
48 | { |
---|
49 | public: |
---|
50 | |
---|
51 | void Update(Map &, NGridType &, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const; |
---|
52 | }; |
---|
53 | |
---|
54 | class TRINITY_DLL_DECL ActiveState : public GridState |
---|
55 | { |
---|
56 | public: |
---|
57 | |
---|
58 | void Update(Map &, NGridType &, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const; |
---|
59 | }; |
---|
60 | |
---|
61 | class TRINITY_DLL_DECL IdleState : public GridState |
---|
62 | { |
---|
63 | public: |
---|
64 | |
---|
65 | void Update(Map &, NGridType &, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const; |
---|
66 | }; |
---|
67 | |
---|
68 | class TRINITY_DLL_DECL RemovalState : public GridState |
---|
69 | { |
---|
70 | public: |
---|
71 | |
---|
72 | void Update(Map &, NGridType &, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const; |
---|
73 | }; |
---|
74 | #endif |
---|