OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
MapBlock.h
1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom 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 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom 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 OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OPENXCOM_MAPBLOCK_H
20 #define OPENXCOM_MAPBLOCK_H
21 
22 #include <string>
23 #include <yaml-cpp/yaml.h>
24 
25 namespace OpenXcom
26 {
27 
28 enum MapBlockType {MT_UNDEFINED = -1, MT_DEFAULT, MT_LANDINGZONE, MT_EWROAD, MT_NSROAD, MT_CROSSING, MT_DIRT, MT_XCOMSPAWN, MT_UBASECOMM, MT_FINALCOMM };
29 class RuleTerrain;
30 
37 class MapBlock
38 {
39 private:
40  std::string _name;
41  int _size_x, _size_y, _size_z;
42  MapBlockType _type, _subType;
43  int _frequency, _timesUsed, _maxCount;
44 public:
45  MapBlock(std::string name, int size_x, int size_y, MapBlockType type);
46  ~MapBlock();
48  void load(const YAML::Node& node);
50  std::string getName() const;
52  int getSizeX() const;
54  int getSizeY() const;
56  int getSizeZ() const;
58  void setSizeZ(int size_z);
60  MapBlockType getType() const;
62  MapBlockType getSubType() const;
64  int getRemainingUses();
66  void markUsed();
68  void reset();
69 
70 };
71 
72 }
73 
74 #endif
~MapBlock()
MapBlock desctruction.
Definition: MapBlock.cpp:34
MapBlockType getType() const
Returns whether this mapblock is a landingzone.
Definition: MapBlock.cpp:105
Represents a Terrain Map Block.
Definition: MapBlock.h:37
void reset()
Resets remaining uses.
Definition: MapBlock.cpp:153
void setSizeZ(int size_z)
Sets the mapblock's z size.
Definition: MapBlock.cpp:87
MapBlock(std::string name, int size_x, int size_y, MapBlockType type)
MapBlock construction.
Definition: MapBlock.cpp:27
std::string getName() const
Gets the mapblock's name (used for MAP generation).
Definition: MapBlock.cpp:60
int getRemainingUses()
Gets either remaining uses or frequency.
Definition: MapBlock.cpp:125
int getSizeY() const
Gets the mapblock's y size.
Definition: MapBlock.cpp:78
MapBlockType getSubType() const
Returns whether this mapblock is a landingzone.
Definition: MapBlock.cpp:114
void load(const YAML::Node &node)
Loads the map block from YAML.
Definition: MapBlock.cpp:42
int getSizeZ() const
Gets the mapblock's z size.
Definition: MapBlock.cpp:96
void markUsed()
Decreases remaining uses.
Definition: MapBlock.cpp:137
int getSizeX() const
Gets the mapblock's x size.
Definition: MapBlock.cpp:69