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::RuleRegion Class Reference

Represents a specific region of the world. More...

#include <RuleRegion.h>

Public Member Functions

 RuleRegion (const std::string &type)
 Creates a blank region ruleset. More...
 
 ~RuleRegion ()
 Cleans up the region ruleset. More...
 
void load (const YAML::Node &node)
 Loads the region from YAML. More...
 
std::string getType () const
 Gets the region's type. More...
 
int getBaseCost () const
 Gets the region's base cost. More...
 
bool insideRegion (double lon, double lat) const
 Checks if a point is inside the region. More...
 
std::vector< City * > * getCities ()
 Gets the cities in this region. More...
 
size_t getWeight () const
 Gets the weight of this region for mission selection. More...
 
const WeightedOptionsgetAvailableMissions () const
 Gets the weighted list of missions for this region.
 
const std::string & getMissionRegion () const
 Gets the substitute mission region.
 
std::pair< double, double > getRandomPoint (size_t site) const
 Gets a random point inside a mission site. More...
 
const std::vector< double > & getLonMax () const
 Gets the maximum longitude.
 
const std::vector< double > & getLonMin () const
 Gets the minimum longitude.
 
const std::vector< double > & getLatMax () const
 Gets the maximum latitude.
 
const std::vector< double > & getLatMin () const
 Gets the minimum latitude.
 

Detailed Description

Represents a specific region of the world.

Contains constant info about a region like area covered and base construction costs.

Constructor & Destructor Documentation

OpenXcom::RuleRegion::RuleRegion ( const std::string &  type)

Creates a blank region ruleset.

Creates a blank ruleset for a certain type of region.

Parameters
typeString defining the type.
OpenXcom::RuleRegion::~RuleRegion ( )

Cleans up the region ruleset.

Deletes the cities from memory.

Member Function Documentation

int OpenXcom::RuleRegion::getBaseCost ( ) const

Gets the region's base cost.

Gets the cost of building a base inside this region.

Returns
The construction cost.
std::vector< City * > * OpenXcom::RuleRegion::getCities ( )

Gets the cities in this region.

Gets the list of cities contained in this region.

Returns
Pointer to a list.
std::pair< double, double > OpenXcom::RuleRegion::getRandomPoint ( size_t  zone) const

Gets a random point inside a mission site.

Gets a random point that is guaranteed to be inside the give zone.

If the region contains cities, they are the sites of zone 0 and the rest of the zones get one index higher.

Parameters
zoneThe target zone.
Returns
A pair of longitude and latitude.
std::string OpenXcom::RuleRegion::getType ( ) const

Gets the region's type.

Gets the language string that names this region.

Each region type has a unique name.

Returns
The region type.
size_t OpenXcom::RuleRegion::getWeight ( ) const

Gets the weight of this region for mission selection.

This is only used when creating a new game, since these weights change in the course of the game.

Returns
The initial weight of this region.
bool OpenXcom::RuleRegion::insideRegion ( double  lon,
double  lat 
) const

Checks if a point is inside the region.

Checks if a point is inside this region.

Parameters
lonLongitude in radians.
latLatitude in radians.
Returns
True if it's inside, false if it's outside.
void OpenXcom::RuleRegion::load ( const YAML::Node &  node)

Loads the region from YAML.

Loads the region type from a YAML file.

Parameters
nodeYAML node.

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