OpenXcom  1.0
Open-source clone of the original X-Com
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 zone) const
 Gets a random point inside a mission zone. More...
 
MissionArea getMissionPoint (size_t zone, Target *target) const
 Gets the mission area for the corresponding target. More...
 
MissionArea getRandomMissionPoint (size_t zone) const
 Gets a random mission area. 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.
 
const std::vector< MissionZone > & getMissionZones () const
 Gets a list of MissionZones. More...
 

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

◆ RuleRegion()

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.

◆ ~RuleRegion()

OpenXcom::RuleRegion::~RuleRegion ( )

Cleans up the region ruleset.

Deletes the cities from memory.

Member Function Documentation

◆ getBaseCost()

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.

◆ getCities()

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.

◆ getMissionPoint()

MissionArea OpenXcom::RuleRegion::getMissionPoint ( size_t  zone,
Target target 
) const

Gets the mission area for the corresponding target.

Gets the area data for the mission point in the specified zone and coordinates.

Parameters
zoneThe target zone.
targetThe target coordinates.
Returns
A MissionArea from which to extract coordinates, textures, or any other pertinent information.

◆ getMissionZones()

const std::vector< MissionZone > & OpenXcom::RuleRegion::getMissionZones ( ) const

Gets a list of MissionZones.

Gets a list of all the missionZones in the region.

Returns
A list of missionZones.

◆ getRandomMissionPoint()

MissionArea OpenXcom::RuleRegion::getRandomMissionPoint ( size_t  zone) const

Gets a random mission area.

Gets the area data for the random mission point in the region.

Returns
A MissionArea from which to extract coordinates, textures, or any other pertinent information.

◆ getRandomPoint()

std::pair< double, double > OpenXcom::RuleRegion::getRandomPoint ( size_t  zone) const

Gets a random point inside a mission zone.

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

Parameters
zoneThe target zone.
Returns
A pair of longitude and latitude.

◆ getType()

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.

◆ getWeight()

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.

◆ insideRegion()

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.

◆ load()

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: