OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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, Ruleset *ruleset)
 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 maxsize, MapBlockType type, bool force=false)
 Gets a random mapblock. More...
 
MapBlockgetMapBlock (const std::string &name)
 Gets a mapblock given its name. More...
 
MapDatagetMapData (int *id, int *mapDataSetID) const
 Gets the mapdata object. More...
 
int getLargeBlockLimit () const
 Gets the maximum amount of large blocks in this terrain. More...
 
void resetMapBlocks ()
 Resets the remaining uses of each mapblock.
 
std::vector< int > * getTextures ()
 Gets the array of globe texture IDs this terrain is loaded on. More...
 
int getHemisphere () const
 Gets the hemishpere this terrain occurs on. More...
 
std::vector< std::string > getCivilianTypes () const
 Gets teh civilian types to use. More...
 
std::vector< int > getRoadTypeOdds () const
 Gets road type odds. More...
 

Detailed Description

Represents a specific type of Battlescape Terrain.

Constructor & Destructor Documentation

OpenXcom::RuleTerrain::~RuleTerrain ( )

Ruleterrain only holds mapblocks.

Map datafiles are referenced.

Member Function Documentation

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

Gets teh 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.
int OpenXcom::RuleTerrain::getHemisphere ( ) const

Gets the hemishpere this terrain occurs on.

-1 = northern, 0 = either, 1 = southern.

Returns
The hemisphere.
int OpenXcom::RuleTerrain::getLargeBlockLimit ( ) const

Gets the maximum amount of large blocks in this terrain.

Returns
The maximum amount.
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.
std::vector< MapBlock * > * OpenXcom::RuleTerrain::getMapBlocks ( )

Gets the terrain's mapblocks.

Gets the array of mapblocks.

Returns
Pointer to the array of mapblocks.
MapData * OpenXcom::RuleTerrain::getMapData ( 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.
std::vector< MapDataSet * > * OpenXcom::RuleTerrain::getMapDataSets ( )

Gets the terrain's mapdatafiles.

Gets the array of mapdatafiles.

Returns
Pointer to the array of mapdatafiles.
std::string OpenXcom::RuleTerrain::getName ( ) const

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

Gets the terrain name.

Returns
The terrain name.
MapBlock * OpenXcom::RuleTerrain::getRandomMapBlock ( int  maxsize,
MapBlockType  type,
bool  force = false 
)

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.
std::vector< int > OpenXcom::RuleTerrain::getRoadTypeOdds ( ) const

Gets road type odds.

Gets the road type odds.

Returns
The road type odds.
std::vector< int > * OpenXcom::RuleTerrain::getTextures ( )

Gets the array of globe texture IDs this terrain is loaded on.

Returns
Pointer to the array of texture IDs.
void OpenXcom::RuleTerrain::load ( const YAML::Node &  node,
Ruleset ruleset 
)

Loads the terrain from YAML.

Loads the terrain from a YAML file.

Parameters
nodeYAML node.
rulesetRuleset for the terrain.

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