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_MAPDATASET_H 20 #define OPENXCOM_MAPDATASET_H 21 22 #include <string> 23 #include <vector> 24 #include <SDL.h> 25 #include <yaml-cpp/yaml.h> 26 27 namespace OpenXcom 28 { 29 30 class MapData; 31 class SurfaceSet; 32 class ResourcePack; 33 34 /** 35 * Represents a Terrain Map Datafile. 36 * Which corresponds to an XCom MCD & PCK file. 37 * The list of map datafiles is stored in RuleSet, but referenced in RuleTerrain. 38 * @sa http://www.ufopaedia.org/index.php?title=MCD 39 */ 40 class MapDataSet 41 { 42 private: 43 std::string _name; 44 std::vector<MapData*> _objects; 45 SurfaceSet *_surfaceSet; 46 bool _loaded; 47 static MapData *_blankTile; 48 static MapData *_scorchedTile; 49 public: 50 MapDataSet(const std::string &name); 51 ~MapDataSet(); 52 /// Loads the map data set from YAML. 53 void load(const YAML::Node& node); 54 /// Loads voxeldata from a DAT file. 55 static void loadLOFTEMPS(const std::string &filename, std::vector<Uint16> *voxelData); 56 /// Gets the dataset name (used for MAP generation). 57 std::string getName() const; 58 /// Gets the dataset size. 59 size_t getSize() const; 60 /// Gets the objects in this dataset. 61 std::vector<MapData*> *getObjects(); 62 /// Gets the surfaces in this dataset. 63 SurfaceSet *getSurfaceset() const; 64 /// Loads the objects from an MCD file. 65 void loadData(); 66 /// Unloads to free memory. 67 void unloadData(); 68 /// Gets a blank floor tile. 69 static MapData *getBlankFloorTile(); 70 /// Gets a scorched earth tile. 71 static MapData *getScorchedEarthTile(); 72 }; 73 74 } 75 76 #endif 77