OpenXcom  1.0
Open-source clone of the original X-Com
MapBlock.h
1 #pragma once
2 /*
3  * Copyright 2010-2016 OpenXcom Developers.
4  *
5  * This file is part of OpenXcom.
6  *
7  * OpenXcom is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * OpenXcom is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
19  */
20 #include <string>
21 #include <vector>
22 #include <yaml-cpp/yaml.h>
23 
24 namespace OpenXcom
25 {
26 
27 enum MapBlockType {MT_UNDEFINED = -1, MT_DEFAULT, MT_LANDINGZONE, MT_EWROAD, MT_NSROAD, MT_CROSSING};
28 class RuleTerrain;
29 class Position;
30 
37 class MapBlock
38 {
39 private:
40  std::string _name;
41  int _size_x, _size_y, _size_z;
42  std::vector<int> _groups, _revealedFloors;
43  std::map<std::string, std::vector<Position> > _items;
44 public:
45  MapBlock(const std::string &name);
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  bool isInGroup(int group);
62  bool isFloorRevealed(int floor);
64  std::map<std::string, std::vector<Position> > *getItems();
65 
66 };
67 
68 }
int getSizeX() const
Gets the mapblock&#39;s x size.
Definition: MapBlock.cpp:99
~MapBlock()
MapBlock destruction.
Definition: MapBlock.cpp:39
std::map< std::string, std::vector< Position > > * getItems()
Gets the layout for any items that belong in this map block.
Definition: MapBlock.cpp:152
bool isFloorRevealed(int floor)
Gets if this floor should be revealed or not.
Definition: MapBlock.cpp:143
MapBlock(const std::string &name)
MapBlock construction.
Definition: MapBlock.cpp:31
Represents a Terrain Map Block.
Definition: MapBlock.h:37
void setSizeZ(int size_z)
Sets the mapblock&#39;s z size.
Definition: MapBlock.cpp:117
int getSizeZ() const
Gets the mapblock&#39;s z size.
Definition: MapBlock.cpp:126
void load(const YAML::Node &node)
Loads the map block from YAML.
Definition: MapBlock.cpp:47
bool isInGroup(int group)
Returns if this mapblock is from the group specified.
Definition: MapBlock.cpp:135
int getSizeY() const
Gets the mapblock&#39;s y size.
Definition: MapBlock.cpp:108
std::string getName() const
Gets the mapblock&#39;s name (used for MAP generation).
Definition: MapBlock.cpp:90
Definition: BaseInfoState.cpp:40