OpenXcom
1.0
Open-source clone of the original X-Com
|
Set of rules and stats for a game. More...
#include <Ruleset.h>
Public Member Functions | |
Ruleset () | |
Creates a blank ruleset. More... | |
~Ruleset () | |
Cleans up the ruleset. More... | |
void | load (const std::string &source) |
Loads a ruleset from the given source. More... | |
SavedGame * | newSave () const |
Generates the starting saved game. More... | |
const std::vector < SoldierNamePool * > & | getPools () const |
Gets the pool list for soldier names. More... | |
RuleCountry * | getCountry (const std::string &id) const |
Gets the ruleset for a country type. More... | |
const std::vector< std::string > & | getCountriesList () const |
Gets the available countries. More... | |
RuleRegion * | getRegion (const std::string &id) const |
Gets the ruleset for a region type. More... | |
const std::vector< std::string > & | getRegionsList () const |
Gets the available regions. More... | |
RuleBaseFacility * | getBaseFacility (const std::string &id) const |
Gets the ruleset for a facility type. More... | |
const std::vector< std::string > & | getBaseFacilitiesList () const |
Gets the available facilities. More... | |
RuleCraft * | getCraft (const std::string &id) const |
Gets the ruleset for a craft type. More... | |
const std::vector< std::string > & | getCraftsList () const |
Gets the available crafts. More... | |
RuleCraftWeapon * | getCraftWeapon (const std::string &id) const |
Gets the ruleset for a craft weapon type. More... | |
const std::vector< std::string > & | getCraftWeaponsList () const |
Gets the available craft weapons. More... | |
RuleItem * | getItem (const std::string &id) const |
Gets the ruleset for an item type. More... | |
const std::vector< std::string > & | getItemsList () const |
Gets the available items. More... | |
RuleUfo * | getUfo (const std::string &id) const |
Gets the ruleset for a UFO type. More... | |
const std::vector< std::string > & | getUfosList () const |
Gets the available UFOs. More... | |
const std::vector< std::string > & | getTerrainList () const |
Gets the available terrains. More... | |
RuleTerrain * | getTerrain (const std::string &name) const |
Gets terrains for battlescape games. More... | |
MapDataSet * | getMapDataSet (const std::string &name) |
Gets mapdatafile for battlescape games. More... | |
RuleSoldier * | getSoldier (const std::string &name) const |
Gets soldier unit rules. More... | |
Unit * | getUnit (const std::string &name) const |
Gets generated unit rules. More... | |
AlienRace * | getAlienRace (const std::string &name) const |
Gets alien race rules. More... | |
const std::vector< std::string > & | getAlienRacesList () const |
Gets the available alien races. More... | |
AlienDeployment * | getDeployment (const std::string &name) const |
Gets deployment rules. More... | |
const std::vector< std::string > & | getDeploymentsList () const |
Gets the available alien deployments. More... | |
Armor * | getArmor (const std::string &name) const |
Gets armor rules. More... | |
const std::vector< std::string > & | getArmorsList () const |
Gets the available armors. More... | |
ArticleDefinition * | getUfopaediaArticle (const std::string &name) const |
Gets Ufopaedia article definition. More... | |
const std::vector< std::string > & | getUfopaediaList () const |
Gets the available articles. More... | |
std::map< std::string, RuleInventory * > * | getInventories () |
Gets the inventory list. More... | |
RuleInventory * | getInventory (const std::string &id) const |
Gets the ruleset for a specific inventory. More... | |
int | getSoldierCost () const |
Gets the cost of a soldier. More... | |
int | getEngineerCost () const |
Gets the cost of an engineer. More... | |
int | getScientistCost () const |
Gets the cost of a scientist. More... | |
int | getPersonnelTime () const |
Gets the transfer time of personnel. More... | |
RuleResearch * | getResearch (const std::string &id) const |
Gets the ruleset for a specific research project. More... | |
const std::vector< std::string > & | getResearchList () const |
Gets the list of all research projects. More... | |
RuleManufacture * | getManufacture (const std::string &id) const |
Gets the ruleset for a specific manufacture project. More... | |
const std::vector< std::string > & | getManufactureList () const |
Gets the list of all manufacture projects. More... | |
std::vector < OpenXcom::RuleBaseFacility * > | getCustomBaseFacilities () const |
Gets facilities for custom bases. More... | |
const UfoTrajectory * | getUfoTrajectory (const std::string &id) const |
Gets a specific UfoTrajectory. More... | |
const RuleAlienMission * | getAlienMission (const std::string &id) const |
Gets the ruleset for a specific alien mission. More... | |
const std::vector< std::string > & | getAlienMissionList () const |
Gets the list of all alien missions. More... | |
const City * | locateCity (double lon, double lat) const |
Gets the city at the specified coordinates. More... | |
const std::vector< std::vector < int > > & | getAlienItemLevels () const |
Gets the alien item level table. More... | |
const YAML::Node & | getStartingBase () |
Gets the Defined starting base. More... | |
MCDPatch * | getMCDPatch (const std::string name) const |
Gets an MCDPatch. More... | |
std::vector< std::pair < std::string, ExtraSprites * > > | getExtraSprites () const |
Gets the list of external Sprites. More... | |
std::vector< std::pair < std::string, ExtraSounds * > > | getExtraSounds () const |
Gets the list of external Sounds. More... | |
std::map< std::string, ExtraStrings * > | getExtraStrings () const |
Gets the list of external Strings. More... | |
std::vector< StatString * > | getStatStrings () const |
Gets the list of StatStrings. More... | |
void | sortLists () |
Sorts all our lists according to their weight. | |
std::vector< std::string > | getPsiRequirements () const |
Gets the research-requirements for Psi-Lab (it's a cache for psiStrengthEval) | |
const std::vector< std::string > & | getInvsList () const |
Returns the sorted list of inventories. More... | |
Soldier * | genSoldier (SavedGame *save) const |
Generates a new soldier. More... | |
Protected Member Functions | |
void | loadFile (const std::string &filename) |
Loads a ruleset from a YAML file. More... | |
void | loadFiles (const std::string &dirname) |
Loads all ruleset files from a directory. More... | |
template<typename T > | |
T * | loadRule (const YAML::Node &node, std::map< std::string, T * > *map, std::vector< std::string > *index=0, const std::string &key="type") |
Loads a ruleset element. More... | |
Set of rules and stats for a game.
A ruleset holds all the constant info that never changes throughout a game, like stats of all the in-game items, countries, research tree, soldier names, starting base, etc.
OpenXcom::Ruleset::Ruleset | ( | ) |
Creates a blank ruleset.
Creates a ruleset with blank sets of rules.
OpenXcom::Ruleset::~Ruleset | ( | ) |
Cleans up the ruleset.
Deletes all the contained rules from memory.
Generates a new soldier.
Creates a new randomly-generated soldier.
save | Saved game the soldier belongs to. |
const std::vector< std::vector< int > > & OpenXcom::Ruleset::getAlienItemLevels | ( | ) | const |
Gets the alien item level table.
const RuleAlienMission * OpenXcom::Ruleset::getAlienMission | ( | const std::string & | id | ) | const |
Gets the ruleset for a specific alien mission.
Returns the rules for the specified alien mission.
id | Alien mission type. |
const std::vector< std::string > & OpenXcom::Ruleset::getAlienMissionList | ( | ) | const |
Gets the list of all alien missions.
Returns the list of alien mission types.
AlienRace * OpenXcom::Ruleset::getAlienRace | ( | const std::string & | name | ) | const |
Gets alien race rules.
Returns the info about a specific alien race.
name | Race name. |
const std::vector< std::string > & OpenXcom::Ruleset::getAlienRacesList | ( | ) | const |
Gets the available alien races.
Returns the list of all alien races.
provided by the ruleset.
Armor * OpenXcom::Ruleset::getArmor | ( | const std::string & | name | ) | const |
Gets armor rules.
Returns the info about a specific armor.
name | Armor name. |
const std::vector< std::string > & OpenXcom::Ruleset::getArmorsList | ( | ) | const |
Gets the available armors.
Returns the list of all armors provided by the ruleset.
const std::vector< std::string > & OpenXcom::Ruleset::getBaseFacilitiesList | ( | ) | const |
Gets the available facilities.
Returns the list of all base facilities provided by the ruleset.
RuleBaseFacility * OpenXcom::Ruleset::getBaseFacility | ( | const std::string & | id | ) | const |
Gets the ruleset for a facility type.
Returns the rules for the specified base facility.
id | Facility type. |
const std::vector< std::string > & OpenXcom::Ruleset::getCountriesList | ( | ) | const |
Gets the available countries.
Returns the list of all countries provided by the ruleset.
RuleCountry * OpenXcom::Ruleset::getCountry | ( | const std::string & | id | ) | const |
Gets the ruleset for a country type.
Returns the rules for the specified country.
id | Country type. |
RuleCraft * OpenXcom::Ruleset::getCraft | ( | const std::string & | id | ) | const |
Gets the ruleset for a craft type.
Returns the rules for the specified craft.
id | Craft type. |
const std::vector< std::string > & OpenXcom::Ruleset::getCraftsList | ( | ) | const |
Gets the available crafts.
Returns the list of all crafts provided by the ruleset.
RuleCraftWeapon * OpenXcom::Ruleset::getCraftWeapon | ( | const std::string & | id | ) | const |
Gets the ruleset for a craft weapon type.
Returns the rules for the specified craft weapon.
id | Craft weapon type. |
const std::vector< std::string > & OpenXcom::Ruleset::getCraftWeaponsList | ( | ) | const |
Gets the available craft weapons.
Returns the list of all craft weapons provided by the ruleset.
std::vector< OpenXcom::RuleBaseFacility * > OpenXcom::Ruleset::getCustomBaseFacilities | ( | ) | const |
Gets facilities for custom bases.
Generates and returns a list of facilities for custom bases.
The list contains all the facilities that are listed in the 'startingBase' part of the ruleset.
AlienDeployment * OpenXcom::Ruleset::getDeployment | ( | const std::string & | name | ) | const |
Gets deployment rules.
Returns the info about a specific deployment.
name | Deployment name. |
const std::vector< std::string > & OpenXcom::Ruleset::getDeploymentsList | ( | ) | const |
Gets the available alien deployments.
Returns the list of all alien deployments provided by the ruleset.
int OpenXcom::Ruleset::getEngineerCost | ( | ) | const |
Gets the cost of an engineer.
Returns the cost of an individual engineer for purchase/maintenance.
std::vector< std::pair< std::string, ExtraSounds * > > OpenXcom::Ruleset::getExtraSounds | ( | ) | const |
Gets the list of external Sounds.
Gets the list of external sounds.
std::vector< std::pair< std::string, ExtraSprites * > > OpenXcom::Ruleset::getExtraSprites | ( | ) | const |
Gets the list of external Sprites.
Gets the list of external sprites.
std::map< std::string, ExtraStrings * > OpenXcom::Ruleset::getExtraStrings | ( | ) | const |
Gets the list of external Strings.
Gets the list of external strings.
std::map< std::string, RuleInventory * > * OpenXcom::Ruleset::getInventories | ( | ) |
Gets the inventory list.
Returns the list of inventories.
RuleInventory * OpenXcom::Ruleset::getInventory | ( | const std::string & | id | ) | const |
const std::vector< std::string > & OpenXcom::Ruleset::getInvsList | ( | ) | const |
Returns the sorted list of inventories.
Returns the list of inventories.
RuleItem * OpenXcom::Ruleset::getItem | ( | const std::string & | id | ) | const |
Gets the ruleset for an item type.
Returns the rules for the specified item.
id | Item type. |
const std::vector< std::string > & OpenXcom::Ruleset::getItemsList | ( | ) | const |
Gets the available items.
Returns the list of all items provided by the ruleset.
RuleManufacture * OpenXcom::Ruleset::getManufacture | ( | const std::string & | id | ) | const |
Gets the ruleset for a specific manufacture project.
Returns the rules for the specified manufacture project.
id | Manufacture project type. |
const std::vector< std::string > & OpenXcom::Ruleset::getManufactureList | ( | ) | const |
Gets the list of all manufacture projects.
Returns the list of manufacture projects.
MapDataSet * OpenXcom::Ruleset::getMapDataSet | ( | const std::string & | name | ) |
Gets mapdatafile for battlescape games.
Returns the info about a specific map data file.
name | Datafile name. |
MCDPatch * OpenXcom::Ruleset::getMCDPatch | ( | const std::string | id | ) | const |
int OpenXcom::Ruleset::getPersonnelTime | ( | ) | const |
Gets the transfer time of personnel.
Returns the time it takes to transfer personnel between bases.
const std::vector< SoldierNamePool * > & OpenXcom::Ruleset::getPools | ( | ) | const |
Gets the pool list for soldier names.
Returns the list of soldier name pools.
RuleRegion * OpenXcom::Ruleset::getRegion | ( | const std::string & | id | ) | const |
Gets the ruleset for a region type.
Returns the rules for the specified region.
id | Region type. |
const std::vector< std::string > & OpenXcom::Ruleset::getRegionsList | ( | ) | const |
Gets the available regions.
Returns the list of all regions provided by the ruleset.
RuleResearch * OpenXcom::Ruleset::getResearch | ( | const std::string & | id | ) | const |
Gets the ruleset for a specific research project.
Returns the rules for the specified research project.
id | Research project type. |
const std::vector< std::string > & OpenXcom::Ruleset::getResearchList | ( | ) | const |
Gets the list of all research projects.
Returns the list of research projects.
int OpenXcom::Ruleset::getScientistCost | ( | ) | const |
Gets the cost of a scientist.
Returns the cost of an individual scientist for purchase/maintenance.
RuleSoldier * OpenXcom::Ruleset::getSoldier | ( | const std::string & | name | ) | const |
Gets soldier unit rules.
Returns the info about a specific unit.
name | Unit name. |
int OpenXcom::Ruleset::getSoldierCost | ( | ) | const |
Gets the cost of a soldier.
Returns the cost of an individual soldier for purchase/maintenance.
const YAML::Node & OpenXcom::Ruleset::getStartingBase | ( | ) |
Gets the Defined starting base.
std::vector< StatString * > OpenXcom::Ruleset::getStatStrings | ( | ) | const |
Gets the list of StatStrings.
RuleTerrain * OpenXcom::Ruleset::getTerrain | ( | const std::string & | name | ) | const |
Gets terrains for battlescape games.
Returns the rules for the specified terrain.
name | Terrain name. |
const std::vector< std::string > & OpenXcom::Ruleset::getTerrainList | ( | ) | const |
Gets the available terrains.
Returns the list of all terrains provided by the ruleset.
RuleUfo * OpenXcom::Ruleset::getUfo | ( | const std::string & | id | ) | const |
Gets the ruleset for a UFO type.
Returns the rules for the specified UFO.
id | UFO type. |
ArticleDefinition * OpenXcom::Ruleset::getUfopaediaArticle | ( | const std::string & | name | ) | const |
Gets Ufopaedia article definition.
Returns the article definition for a given name.
name | Article name. |
const std::vector< std::string > & OpenXcom::Ruleset::getUfopaediaList | ( | ) | const |
Gets the available articles.
Returns the list of all articles provided by the ruleset.
const std::vector< std::string > & OpenXcom::Ruleset::getUfosList | ( | ) | const |
Gets the available UFOs.
Returns the list of all ufos provided by the ruleset.
const UfoTrajectory * OpenXcom::Ruleset::getUfoTrajectory | ( | const std::string & | id | ) | const |
Gets a specific UfoTrajectory.
Returns the data for the specified ufo trajectory.
id | Ufo trajectory id. |
Unit * OpenXcom::Ruleset::getUnit | ( | const std::string & | name | ) | const |
Gets generated unit rules.
Returns the info about a specific unit.
name | Unit name. |
void OpenXcom::Ruleset::load | ( | const std::string & | source | ) |
Loads a ruleset from the given source.
Loads a ruleset's contents from the given source.
source | The source to use. |
|
protected |
Loads a ruleset from a YAML file.
Loads a ruleset's contents from a YAML file.
Rules that match pre-existing rules overwrite them.
filename | YAML filename. |
|
protected |
Loads all ruleset files from a directory.
Loads the contents of all the rule files in the given directory.
dirname | The name of an existing directory containing rule files. |
|
protected |
Loads a ruleset element.
Loads a rule element, adding/removing from vectors as necessary.
node | YAML node. |
map | Map associated to the rule type. |
index | Index vector for the rule type. |
key | Rule key name. |
const City * OpenXcom::Ruleset::locateCity | ( | double | lon, |
double | lat | ||
) | const |
Gets the city at the specified coordinates.
Finds the city at coordinates lon, lat.
The search will only match exact coordinates.
lon | The longtitude. |
lat | The latitude. |
SavedGame * OpenXcom::Ruleset::newSave | ( | ) | const |
Generates the starting saved game.
Generates a brand new saved game with starting data.