OpenXcom  1.0
Open-source clone of the original X-Com
Public Member Functions | List of all members
OpenXcom::RuleTerrain Class Reference

Represents a specific type of Battlescape Terrain. More...

#include <RuleTerrain.h>

Public Member Functions

 RuleTerrain (const std::string &name)
 RuleTerrain construction.
 
 ~RuleTerrain ()
 Ruleterrain only holds mapblocks. More...
 
void load (const YAML::Node &node, Mod *mod)
 Loads the terrain from YAML. More...
 
std::string getName () const
 Gets the terrain's name (used for MAP generation). More...
 
std::vector< MapBlock * > * getMapBlocks ()
 Gets the terrain's mapblocks. More...
 
std::vector< MapDataSet * > * getMapDataSets ()
 Gets the terrain's mapdatafiles. More...
 
MapBlockgetRandomMapBlock (int maxSizeX, int maxSizeY, int group, bool force=true)
 Gets a random mapblock. More...
 
MapBlockgetMapBlock (const std::string &name)
 Gets a mapblock given its name. More...
 
MapDatagetMapData (unsigned int *id, int *mapDataSetID) const
 Gets the mapdata object. More...
 
std::vector< std::string > getCivilianTypes () const
 Gets the civilian types to use. More...
 
int getMinDepth () const
 Gets the minimum depth. More...
 
int getMaxDepth () const
 Gets the maximum depth. More...
 
int getAmbience () const
 Gets the ambient sound effect. More...
 
std::string getScript () const
 Gets the generation script name. More...
 
const std::vector< std::string > & getMusic () const
 Gets the list of music to pick from. More...
 

Detailed Description

Represents a specific type of Battlescape Terrain.

Constructor & Destructor Documentation

◆ ~RuleTerrain()

OpenXcom::RuleTerrain::~RuleTerrain ( )

Ruleterrain only holds mapblocks.

Map datafiles are referenced.

Member Function Documentation

◆ getAmbience()

int OpenXcom::RuleTerrain::getAmbience ( ) const

Gets the ambient sound effect.

Gets The ambient sound effect.

Returns
The ambient sound effect.

◆ getCivilianTypes()

std::vector< std::string > OpenXcom::RuleTerrain::getCivilianTypes ( ) const

Gets the civilian types to use.

Gets the list of civilian types to use on this terrain (default MALE_CIVILIAN and FEMALE_CIVILIAN)

Returns
list of civilian types to use.

◆ getMapBlock()

MapBlock * OpenXcom::RuleTerrain::getMapBlock ( const std::string &  name)

Gets a mapblock given its name.

Gets a mapblock with a given name.

Parameters
nameThe name of the mapblock.
Returns
Pointer to mapblock.

◆ getMapBlocks()

std::vector< MapBlock * > * OpenXcom::RuleTerrain::getMapBlocks ( )

Gets the terrain's mapblocks.

Gets the array of mapblocks.

Returns
Pointer to the array of mapblocks.

◆ getMapData()

MapData * OpenXcom::RuleTerrain::getMapData ( unsigned int *  id,
int *  mapDataSetID 
) const

Gets the mapdata object.

Gets a mapdata object.

Parameters
idThe id in the terrain.
mapDataSetIDThe id of the map data set.
Returns
Pointer to MapData object.

◆ getMapDataSets()

std::vector< MapDataSet * > * OpenXcom::RuleTerrain::getMapDataSets ( )

Gets the terrain's mapdatafiles.

Gets the array of mapdatafiles.

Returns
Pointer to the array of mapdatafiles.

◆ getMaxDepth()

int OpenXcom::RuleTerrain::getMaxDepth ( ) const

Gets the maximum depth.

Gets the max depth.

Returns
max depth.

◆ getMinDepth()

int OpenXcom::RuleTerrain::getMinDepth ( ) const

Gets the minimum depth.

Gets the min depth.

Returns
The min depth.

◆ getMusic()

const std::vector< std::string > & OpenXcom::RuleTerrain::getMusic ( ) const

Gets the list of music to pick from.

Gets The list of musics this terrain has to choose from.

Returns
The list of track names.

◆ getName()

std::string OpenXcom::RuleTerrain::getName ( ) const

Gets the terrain's name (used for MAP generation).

Gets the terrain name.

Returns
The terrain name.

◆ getRandomMapBlock()

MapBlock * OpenXcom::RuleTerrain::getRandomMapBlock ( int  maxSizeX,
int  maxSizeY,
int  group,
bool  force = true 
)

Gets a random mapblock.

Gets a random mapblock within the given constraints.

Parameters
maxsizeThe maximum size of the mapblock (10 or 20 or 999 - don't care).
typeWhether this must be a block of a certain type.
forceWhether to enforce the max size.
Returns
Pointer to the mapblock.

◆ getScript()

std::string OpenXcom::RuleTerrain::getScript ( ) const

Gets the generation script name.

Gets The generation script name.

Returns
The name of the script to use.

◆ load()

void OpenXcom::RuleTerrain::load ( const YAML::Node &  node,
Mod mod 
)

Loads the terrain from YAML.

Loads the terrain from a YAML file.

Parameters
nodeYAML node.
modMod for the terrain.

The documentation for this class was generated from the following files: