OpenXcom
1.0
Open-source clone of the original X-Com
|
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 WeightedOptions & | getAvailableMissions () 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. | |
Represents a specific region of the world.
Contains constant info about a region like area covered and base construction costs.
OpenXcom::RuleRegion::RuleRegion | ( | const std::string & | type | ) |
Creates a blank region ruleset.
Creates a blank ruleset for a certain type of region.
type | String defining the type. |
OpenXcom::RuleRegion::~RuleRegion | ( | ) |
Cleans up the region ruleset.
Deletes the cities from memory.
int OpenXcom::RuleRegion::getBaseCost | ( | ) | const |
Gets the region's base cost.
Gets the cost of building a base inside this region.
std::vector< City * > * OpenXcom::RuleRegion::getCities | ( | ) |
Gets the cities in this region.
Gets the list of cities contained in this region.
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.
zone | The target zone. |
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.
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.
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.
lon | Longitude in radians. |
lat | Latitude in radians. |
void OpenXcom::RuleRegion::load | ( | const YAML::Node & | node | ) |
Loads the region from YAML.
Loads the region type from a YAML file.
node | YAML node. |