1 /*
2  *  This file is part of Dune Legacy.
3  *
4  *  Dune Legacy 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.
8  *
9  *  Dune Legacy 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.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with Dune Legacy.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef WALL_H
19 #define WALL_H
20 
21 #include <structures/StructureBase.h>
22 
23 class Wall : public StructureBase
24 {
25 public:
26     typedef enum {
27         Wall_Standalone     = 1,
28         Wall_LeftRight      = 2,
29         Wall_UpRight        = 3,
30         Wall_UpDown         = 4,
31         Wall_DownRight      = 5,
32         Wall_UpDownRight    = 6,
33         Wall_UpLeft         = 7,
34         Wall_UpLeftRight    = 8,
35         Wall_DownLeft       = 9,
36         Wall_UpDownLeft     = 10,
37         Wall_DownLeftRight  = 11,
38         Wall_Full           = 12
39     } WALLTYPE;
40 
41     explicit Wall(House* newOwner);
42     explicit Wall(InputStream& stream);
43     void init();
44     virtual ~Wall();
45 
46     virtual void save(OutputStream& stream) const;
47 
48     void destroy();
49 
50     /**
51         Can this structure be captured by infantry units?
52         \return true, if this structure can be captured, false otherwise
53     */
canBeCaptured()54     virtual bool canBeCaptured() const { return false; };
55 
setLocation(const Coord & location)56     inline void setLocation(const Coord& location) { setLocation(location.x, location.y); }
57     virtual void setLocation(int xPos, int yPos);
58 
59 private:
setWallTile(int newTile)60     inline void setWallTile(int newTile) {
61         curAnimFrame = firstAnimFrame = lastAnimFrame = newTile;
62     }
63 
64     void fixWall();
65 
66     bool bWallDestroyedUp;
67     bool bWallDestroyedRight;
68     bool bWallDestroyedDown;
69     bool bWallDestroyedLeft;
70 
71 };
72 
73 #endif //WALL_H
74