22 #include <yaml-cpp/yaml.h> 23 #include <SDL_video.h> 29 enum MapDirection {MD_NONE, MD_VERTICAL, MD_HORIZONTAL, MD_BOTH};
33 std::map<std::string, MCDReplacement> replacements;
37 if (replacements.find(type) == replacements.end())
42 return &replacements[type];
45 enum MapScriptCommand {MSC_UNDEFINED = -1, MSC_ADDBLOCK, MSC_ADDLINE, MSC_ADDCRAFT, MSC_ADDUFO, MSC_DIGTUNNEL, MSC_FILLAREA, MSC_CHECKBLOCK, MSC_REMOVE, MSC_RESIZE};
53 MapScriptCommand _type;
54 std::vector<SDL_Rect*> _rects;
55 std::vector<int> _groups, _blocks, _frequencies, _maxUses, _conditionals;
56 std::vector<int> _groupsTemp, _blocksTemp, _frequenciesTemp, _maxUsesTemp;
57 int _sizeX, _sizeY, _sizeZ, _executionChances, _executions, _cumulativeFrequency, _label;
58 MapDirection _direction;
70 void load(
const YAML::Node& node);
74 MapScriptCommand
getType()
const {
return _type;};
76 const std::vector<SDL_Rect*> *
getRects()
const {
return &_rects;};
92 const std::vector<int> *
getGroups()
const {
return &_groups;};
94 const std::vector<int> *
getBlocks()
const {
return &_blocks;};
int getExecutions() const
Gets how many times this command repeats (1 repeat means 2 executions)
Definition: MapScript.h:88
MapBlock * getNextBlock(RuleTerrain *terrain)
Randomly generate a block from within either the array of groups or blocks.
Definition: MapScript.cpp:363
Represents a Terrain Map Block.
Definition: MapBlock.h:37
const std::vector< SDL_Rect * > * getRects() const
Gets the rects, describing the areas this command applies to.
Definition: MapScript.h:76
MapScriptCommand getType() const
Gets what type of command this is.
Definition: MapScript.h:74
int getSizeX() const
Gets the X size for this command.
Definition: MapScript.h:78
TunnelData * getTunnelData()
Gets the mcd replacement data for tunnel replacements.
Definition: MapScript.h:98
const std::vector< int > * getBlocks() const
Gets the blocks vector for iteration.
Definition: MapScript.h:94
int getSizeY() const
Gets the Y size for this command.
Definition: MapScript.h:80
int getSizeZ() const
Gets the Z size for this command.
Definition: MapScript.h:82
const std::vector< int > * getGroups() const
Gets the groups vector for iteration.
Definition: MapScript.h:92
std::string getUFOName() const
Gets the UFO's name (for setUFO)
Definition: MapScript.cpp:381
const std::vector< int > * getConditionals() const
Gets what conditions apply to this command.
Definition: MapScript.h:90
Definition: MapScript.h:30
MapDirection getDirection() const
Gets the direction this command goes (for lines and tunnels).
Definition: MapScript.h:96
Definition: MapScript.h:31
int getLabel() const
Gets the label for this command.
Definition: MapScript.h:86
Definition: MapScript.h:50
void load(const YAML::Node &node)
Loads information from a ruleset file.
Definition: MapScript.cpp:47
int getChancesOfExecution() const
Get the chances of this command executing.
Definition: MapScript.h:84
Represents a specific type of Battlescape Terrain.
Definition: RuleTerrain.h:39
Definition: BaseInfoState.cpp:40
void init()
Initializes all the variables and junk for a mapscript command.
Definition: MapScript.cpp:267