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

Stores the information about alien strategy. More...

#include <AlienStrategy.h>

Public Member Functions

 AlienStrategy ()
 Create an AlienStrategy with no data. More...
 
 ~AlienStrategy ()
 Free resources used by the AlienStrategy. More...
 
void init (const Mod *mod)
 Initialize values according to the rules. More...
 
void load (const YAML::Node &node)
 Loads the data from YAML. More...
 
YAML::Node save () const
 Saves the data to YAML. More...
 
std::string chooseRandomRegion (const Mod *mod)
 Choose a random region for a regular mission. More...
 
std::string chooseRandomMission (const std::string &region) const
 Choose a random mission for a region. More...
 
bool removeMission (const std::string &region, const std::string &mission)
 Remove a region and mission from the list of posibilities. More...
 
int getMissionsRun (const std::string &varName)
 Checks the number of missions run labelled as "varName". More...
 
void addMissionRun (const std::string &varName)
 Increments the number of missions run labelled as "varName". More...
 
void addMissionLocation (const std::string &varName, const std::string &regionName, int zoneNumber, int maximum)
 Adds a mission location to our storage array. More...
 
bool validMissionLocation (const std::string &varName, const std::string &regionName, int zoneNumber)
 Checks that a given mission location (city or whatever) isn't stored in our list of previously attacked locations. More...
 
bool validMissionRegion (const std::string &regionName)
 Checks that a given region appears in our strategy table. More...
 

Detailed Description

Stores the information about alien strategy.

Constructor & Destructor Documentation

◆ AlienStrategy()

OpenXcom::AlienStrategy::AlienStrategy ( )

Create an AlienStrategy with no data.

Create an AlienStrategy with no values.

Running a game like this will most likely crash.

◆ ~AlienStrategy()

OpenXcom::AlienStrategy::~AlienStrategy ( )

Free resources used by the AlienStrategy.

Free all resources used by this AlienStrategy.

Member Function Documentation

◆ addMissionLocation()

void OpenXcom::AlienStrategy::addMissionLocation ( const std::string &  varName,
const std::string &  regionName,
int  zoneNumber,
int  maximum 
)

Adds a mission location to our storage array.

Parameters
varNamethe name on the variable under which to store this info.
regionNamethe name of the region we're using.
zoneNumberthe number of the zone within that region we're using.
maximumthe maximum size of the list we want to maintain.

◆ addMissionRun()

void OpenXcom::AlienStrategy::addMissionRun ( const std::string &  varName)

Increments the number of missions run labelled as "varName".

Parameters
varNamethe variable name that we want to use to keep track of this.

◆ chooseRandomMission()

std::string OpenXcom::AlienStrategy::chooseRandomMission ( const std::string &  region) const

Choose a random mission for a region.

Choose one missions available for region.

Parameters
regionThe region id.
Returns
The mission id.

◆ chooseRandomRegion()

std::string OpenXcom::AlienStrategy::chooseRandomRegion ( const Mod mod)

Choose a random region for a regular mission.

Choose one of the regions for a mission.

Parameters
modPointer to the mod.
Returns
The region id.

◆ getMissionsRun()

int OpenXcom::AlienStrategy::getMissionsRun ( const std::string &  varName)

Checks the number of missions run labelled as "varName".

Returns
the number of missions run under the variable name.

◆ init()

void OpenXcom::AlienStrategy::init ( const Mod mod)

Initialize values according to the rules.

Get starting values from the rules.

Parameters
modPointer to the game mod.

◆ load()

void OpenXcom::AlienStrategy::load ( const YAML::Node &  node)

Loads the data from YAML.

Loads the data from a YAML file.

Parameters
nodeYAML node.

◆ removeMission()

bool OpenXcom::AlienStrategy::removeMission ( const std::string &  region,
const std::string &  mission 
)

Remove a region and mission from the list of posibilities.

Remove mission from the list of possible missions for region.

Parameters
regionThe region id.
missionThe mission id.
Returns
If there are no more regions with missions available.

◆ save()

YAML::Node OpenXcom::AlienStrategy::save ( ) const

Saves the data to YAML.

Saves the alien data to a YAML file.

Returns
YAML node.

◆ validMissionLocation()

bool OpenXcom::AlienStrategy::validMissionLocation ( const std::string &  varName,
const std::string &  regionName,
int  zoneNumber 
)

Checks that a given mission location (city or whatever) isn't stored in our list of previously attacked locations.

Parameters
varNamethe name of the variable that is storing our data.
regionNamethe name of the region we're looking for.
zoneNumberthe number in the region that we want to check.
Returns
if the region is valid (meaning it is not in our table).

◆ validMissionRegion()

bool OpenXcom::AlienStrategy::validMissionRegion ( const std::string &  region)

Checks that a given region appears in our strategy table.

Parameters
regionthe region we want to check for validity.
Returns
if the region appears in the table or not.

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