OpenXcom
1.0
Open-source clone of the original X-Com
|
The game data that gets written to disk when the game is saved. More...
#include <SavedGame.h>
Public Member Functions | |
SavedGame () | |
Creates a new saved game. More... | |
~SavedGame () | |
Cleans up the saved game. More... | |
void | load (const std::string &filename, Ruleset *rule) |
Loads a saved game from YAML. More... | |
void | save (const std::string &filename) const |
Saves a saved game to YAML. More... | |
std::wstring | getName () const |
Gets the game name. More... | |
void | setName (const std::wstring &name) |
Sets the game name. More... | |
GameDifficulty | getDifficulty () const |
Gets the game difficulty. More... | |
void | setDifficulty (GameDifficulty difficulty) |
Sets the game difficulty. More... | |
bool | isIronman () const |
Gets if the game is in ironman mode. More... | |
void | setIronman (bool ironman) |
Sets if the game is in ironman mode. More... | |
int | getFunds () const |
Gets the current funds. More... | |
const std::vector< int > & | getFundsList () const |
Gets the list of funds from previous months. More... | |
void | setFunds (int funds) |
Sets new funds. More... | |
double | getGlobeLongitude () const |
Gets the current globe longitude. More... | |
void | setGlobeLongitude (double lon) |
Sets the new globe longitude. More... | |
double | getGlobeLatitude () const |
Gets the current globe latitude. More... | |
void | setGlobeLatitude (double lat) |
Sets the new globe latitude. More... | |
int | getGlobeZoom () const |
Gets the current globe zoom. More... | |
void | setGlobeZoom (int zoom) |
Sets the new globe zoom. More... | |
void | monthlyFunding () |
Handles monthly funding. More... | |
GameTime * | getTime () const |
Gets the current game time. More... | |
void | setTime (GameTime time) |
Sets the current game time. More... | |
int | getId (const std::string &name) |
Gets the current ID for an object. More... | |
std::vector< Country * > * | getCountries () |
Gets the list of countries. More... | |
int | getCountryFunding () const |
Gets the total country funding. More... | |
std::vector< Region * > * | getRegions () |
Gets the list of regions. More... | |
std::vector< Base * > * | getBases () |
Gets the list of bases. More... | |
const std::vector< Base * > * | getBases () const |
Gets the list of bases. More... | |
int | getBaseMaintenance () const |
Gets the total base maintenance. More... | |
std::vector< Ufo * > * | getUfos () |
Gets the list of UFOs. More... | |
std::vector< Waypoint * > * | getWaypoints () |
Gets the list of waypoints. More... | |
std::vector< TerrorSite * > * | getTerrorSites () |
Gets the list of terror sites. More... | |
SavedBattleGame * | getSavedBattle () |
Gets the current battle game. More... | |
void | setBattleGame (SavedBattleGame *battleGame) |
Sets the current battle game. More... | |
void | addFinishedResearch (const RuleResearch *r, const Ruleset *ruleset=NULL) |
Add a finished ResearchProject. More... | |
const std::vector< const RuleResearch * > & | getDiscoveredResearch () const |
Get the list of already discovered research projects. More... | |
void | getAvailableResearchProjects (std::vector< RuleResearch * > &projects, const Ruleset *ruleset, Base *base) const |
Get the list of ResearchProject which can be researched in a Base. More... | |
void | getAvailableProductions (std::vector< RuleManufacture * > &productions, const Ruleset *ruleset, Base *base) const |
Get the list of Productions which can be manufactured in a Base. More... | |
void | getDependableResearch (std::vector< RuleResearch * > &dependables, const RuleResearch *research, const Ruleset *ruleset, Base *base) const |
Get the list of newly available research projects once a research has been completed. More... | |
void | getDependableManufacture (std::vector< RuleManufacture * > &dependables, const RuleResearch *research, const Ruleset *ruleset, Base *base) const |
Get the list of newly available manufacture projects once a research has been completed. More... | |
bool | isResearchAvailable (RuleResearch *r, const std::vector< const RuleResearch * > &unlocked, const Ruleset *ruleset) const |
Check whether a ResearchProject can be researched. More... | |
bool | isResearched (const std::string &research) const |
Gets if a research has been unlocked. More... | |
bool | isResearched (const std::vector< std::string > &research) const |
Gets if a list of research has been unlocked. More... | |
Soldier * | getSoldier (int id) const |
Gets the soldier matching this ID. More... | |
bool | handlePromotions (std::vector< Soldier * > &participants) |
Handles the higher promotions. More... | |
void | inspectSoldiers (Soldier **highestRanked, size_t *total, int rank) |
Checks how many soldiers of a rank exist and which one has the highest score. More... | |
std::vector< AlienBase * > * | getAlienBases () |
Returns the list of alien bases. More... | |
void | setDebugMode () |
Sets debug mode. More... | |
bool | getDebugMode () const |
Gets debug mode. More... | |
std::vector< int > | getMaintenances () |
return a list of maintenance costs More... | |
void | addResearchScore (int score) |
sets the research score for the month More... | |
std::vector< int > & | getResearchScores () |
gets the list of research scores More... | |
std::vector< int > | getIncomes () |
gets the list of incomes. More... | |
std::vector< int > | getExpenditures () |
gets the list of expenditures. More... | |
bool | getWarned () const |
gets whether or not the player has been warned More... | |
void | setWarned (bool warned) |
sets whether or not the player has been warned More... | |
AlienStrategy & | getAlienStrategy () |
Full access to the alien strategy data. | |
const AlienStrategy & | getAlienStrategy () const |
Read-only access to the alien strategy data. | |
std::vector< AlienMission * > & | getAlienMissions () |
Full access to the current alien missions. | |
const std::vector < AlienMission * > & | getAlienMissions () const |
Read-only access to the current alien missions. | |
AlienMission * | getAlienMission (const std::string ®ion, const std::string &type) const |
Gets a mission matching region and type. More... | |
Region * | locateRegion (double lon, double lat) const |
Locate a region containing a position. More... | |
Region * | locateRegion (const Target &target) const |
Locate a region containing a Target. More... | |
int | getMonthsPassed () const |
Return the month counter. | |
const std::string & | getGraphRegionToggles () const |
Return the GraphRegionToggles. | |
const std::string & | getGraphCountryToggles () const |
Return the GraphCountryToggles. | |
const std::string & | getGraphFinanceToggles () const |
Return the GraphFinanceToggles. | |
void | setGraphRegionToggles (const std::string &value) |
Sets the GraphRegionToggles. More... | |
void | setGraphCountryToggles (const std::string &value) |
Sets the GraphCountryToggles. More... | |
void | setGraphFinanceToggles (const std::string &value) |
Sets the GraphFinanceToggles. More... | |
void | addMonth () |
Increment the month counter. | |
void | addPoppedResearch (const RuleResearch *research) |
add a research to the "popped up" array | |
bool | wasResearchPopped (const RuleResearch *research) |
check if a research is on the "popped up" array | |
void | removePoppedResearch (const RuleResearch *research) |
remove a research from the "popped up" array | |
std::vector< Soldier * > * | getDeadSoldiers () |
Gets the list of dead soldiers. More... | |
Base * | getSelectedBase () |
Gets the last selected player base. More... | |
void | setSelectedBase (size_t base) |
Set the last selected player base. More... | |
int | getSoldierScore (Soldier *soldier) |
Evaluate the score of a soldier based on all of his stats, missions and kills. More... | |
Static Public Member Functions | |
static std::vector< SaveInfo > | getList (Language *lang, bool autoquick) |
Gets list of saves in the user directory. More... | |
The game data that gets written to disk when the game is saved.
A saved game holds all the variable info in a game like funds, game time, current bases and contents, world activities, score, etc.
OpenXcom::SavedGame::SavedGame | ( | ) |
Creates a new saved game.
Initializes a brand new saved game according to the specified difficulty.
OpenXcom::SavedGame::~SavedGame | ( | ) |
Cleans up the saved game.
Deletes the game content from memory.
void OpenXcom::SavedGame::addFinishedResearch | ( | const RuleResearch * | r, |
const Ruleset * | ruleset = NULL |
||
) |
Add a finished ResearchProject.
Add a ResearchProject to the list of already discovered ResearchProject.
r | The newly found ResearchProject |
ruleset | the game Ruleset |
void OpenXcom::SavedGame::addResearchScore | ( | int | score | ) |
sets the research score for the month
adds to this month's research score
score | the amount to add. |
std::vector< AlienBase * > * OpenXcom::SavedGame::getAlienBases | ( | ) |
Returns the list of alien bases.
AlienMission * OpenXcom::SavedGame::getAlienMission | ( | const std::string & | region, |
const std::string & | type | ||
) | const |
Gets a mission matching region and type.
Find a mission from the active alien missions.
region | The region ID. |
type | The mission type ID. |
void OpenXcom::SavedGame::getAvailableProductions | ( | std::vector< RuleManufacture * > & | productions, |
const Ruleset * | ruleset, | ||
Base * | base | ||
) | const |
void OpenXcom::SavedGame::getAvailableResearchProjects | ( | std::vector< RuleResearch * > & | projects, |
const Ruleset * | ruleset, | ||
Base * | base | ||
) | const |
Get the list of ResearchProject which can be researched in a Base.
Get the list of RuleResearch which can be researched in a Base.
projects | the list of ResearchProject which are available. |
ruleset | the game Ruleset |
base | a pointer to a Base |
int OpenXcom::SavedGame::getBaseMaintenance | ( | ) | const |
Gets the total base maintenance.
Adds up the monthly maintenance of all the bases.
std::vector< Base * > * OpenXcom::SavedGame::getBases | ( | ) |
Gets the list of bases.
Returns the list of player bases.
const std::vector< Base * > * OpenXcom::SavedGame::getBases | ( | ) | const |
Gets the list of bases.
Returns an immutable list of player bases.
std::vector< Country * > * OpenXcom::SavedGame::getCountries | ( | ) |
Gets the list of countries.
Returns the list of countries in the game world.
int OpenXcom::SavedGame::getCountryFunding | ( | ) | const |
Gets the total country funding.
Adds up the monthly funding of all the countries.
std::vector< Soldier * > * OpenXcom::SavedGame::getDeadSoldiers | ( | ) |
Gets the list of dead soldiers.
Returns the list of dead soldiers.
bool OpenXcom::SavedGame::getDebugMode | ( | ) | const |
Gets debug mode.
Gets the current debug mode.
void OpenXcom::SavedGame::getDependableManufacture | ( | std::vector< RuleManufacture * > & | dependables, |
const RuleResearch * | research, | ||
const Ruleset * | ruleset, | ||
Base * | base | ||
) | const |
Get the list of newly available manufacture projects once a research has been completed.
Get the list of newly available manufacture projects once a ResearchProject has been completed.
This function check for fake ResearchProject.
dependables | the list of RuleManufacture which are now available. |
research | The RuleResearch which has just been discovered |
ruleset | the Game Ruleset |
base | a pointer to a Base |
void OpenXcom::SavedGame::getDependableResearch | ( | std::vector< RuleResearch * > & | dependables, |
const RuleResearch * | research, | ||
const Ruleset * | ruleset, | ||
Base * | base | ||
) | const |
Get the list of newly available research projects once a research has been completed.
Get the list of newly available research projects once a ResearchProject has been completed.
This function check for fake ResearchProject.
dependables | the list of RuleResearch which are now available. |
research | The RuleResearch which has just been discovered |
ruleset | the Game Ruleset |
base | a pointer to a Base |
GameDifficulty OpenXcom::SavedGame::getDifficulty | ( | ) | const |
Gets the game difficulty.
Returns the game's difficulty level.
const std::vector< const RuleResearch * > & OpenXcom::SavedGame::getDiscoveredResearch | ( | ) | const |
Get the list of already discovered research projects.
Returns the list of already discovered ResearchProject.
std::vector< int > OpenXcom::SavedGame::getExpenditures | ( | ) |
gets the list of expenditures.
return the list of expenditures scores
int OpenXcom::SavedGame::getFunds | ( | ) | const |
Gets the current funds.
Returns the player's current funds.
const std::vector< int > & OpenXcom::SavedGame::getFundsList | ( | ) | const |
Gets the list of funds from previous months.
Returns the player's funds for the last 12 months.
double OpenXcom::SavedGame::getGlobeLatitude | ( | ) | const |
Gets the current globe latitude.
Returns the current latitude of the Geoscape globe.
double OpenXcom::SavedGame::getGlobeLongitude | ( | ) | const |
Gets the current globe longitude.
Returns the current longitude of the Geoscape globe.
int OpenXcom::SavedGame::getGlobeZoom | ( | ) | const |
Gets the current globe zoom.
Returns the current zoom level of the Geoscape globe.
int OpenXcom::SavedGame::getId | ( | const std::string & | name | ) |
Gets the current ID for an object.
Returns the latest ID for the specified object and increases it.
name | Object name. |
std::vector< int > OpenXcom::SavedGame::getIncomes | ( | ) |
gets the list of incomes.
return the list of income scores
Gets list of saves in the user directory.
Gets all the info of the saves found in the user folder.
lang | Loaded language. |
autoquick | Include autosaves and quicksaves. |
std::vector< int > OpenXcom::SavedGame::getMaintenances | ( | ) |
return a list of maintenance costs
return the list of monthly maintenance costs
std::wstring OpenXcom::SavedGame::getName | ( | ) | const |
Gets the game name.
Returns the game's name shown in Save screens.
std::vector< Region * > * OpenXcom::SavedGame::getRegions | ( | ) |
Gets the list of regions.
Returns the list of world regions.
std::vector< int > & OpenXcom::SavedGame::getResearchScores | ( | ) |
gets the list of research scores
return the list of research scores
SavedBattleGame * OpenXcom::SavedGame::getSavedBattle | ( | ) |
Gets the current battle game.
Get pointer to the battleGame object.
Base * OpenXcom::SavedGame::getSelectedBase | ( | ) |
Gets the last selected player base.
Returns the last selected player base.
Soldier * OpenXcom::SavedGame::getSoldier | ( | int | id | ) | const |
int OpenXcom::SavedGame::getSoldierScore | ( | Soldier * | soldier | ) |
Evaluate the score of a soldier based on all of his stats, missions and kills.
soldier | the soldier to get a score for. |
std::vector< TerrorSite * > * OpenXcom::SavedGame::getTerrorSites | ( | ) |
Gets the list of terror sites.
Returns the list of terror sites.
GameTime * OpenXcom::SavedGame::getTime | ( | ) | const |
Gets the current game time.
Returns the current time of the game.
std::vector< Ufo * > * OpenXcom::SavedGame::getUfos | ( | ) |
Gets the list of UFOs.
Returns the list of alien UFOs.
bool OpenXcom::SavedGame::getWarned | ( | ) | const |
gets whether or not the player has been warned
return if the player has been warned about poor performance.
std::vector< Waypoint * > * OpenXcom::SavedGame::getWaypoints | ( | ) |
Gets the list of waypoints.
Returns the list of craft waypoints.
bool OpenXcom::SavedGame::handlePromotions | ( | std::vector< Soldier * > & | participants | ) |
Handles the higher promotions.
Handles the higher promotions (not the rookie-squaddie ones).
participants | a list of soldiers that were actually present at the battle. |
void OpenXcom::SavedGame::inspectSoldiers | ( | Soldier ** | highestRanked, |
size_t * | total, | ||
int | rank | ||
) |
Checks how many soldiers of a rank exist and which one has the highest score.
highestRanked | Pointer to store the highest-scoring soldier of that rank. |
total | Pointer to an int to store the total in. |
rank | Rank to inspect. |
bool OpenXcom::SavedGame::isIronman | ( | ) | const |
Gets if the game is in ironman mode.
Returns if the game is set to ironman mode.
Ironman games cannot be manually saved.
bool OpenXcom::SavedGame::isResearchAvailable | ( | RuleResearch * | r, |
const std::vector< const RuleResearch * > & | unlocked, | ||
const Ruleset * | ruleset | ||
) | const |
Check whether a ResearchProject can be researched.
r | the RuleResearch to test. |
unlocked | the list of currently unlocked RuleResearch |
ruleset | the current Ruleset |
bool OpenXcom::SavedGame::isResearched | ( | const std::string & | research | ) | const |
Gets if a research has been unlocked.
Returns if a certain research has been completed.
research | Research ID. |
bool OpenXcom::SavedGame::isResearched | ( | const std::vector< std::string > & | research | ) | const |
Gets if a list of research has been unlocked.
Returns if a certain list of research has been completed.
research | List of research IDs. |
void OpenXcom::SavedGame::load | ( | const std::string & | filename, |
Ruleset * | rule | ||
) |
Loads a saved game from YAML.
Loads a saved game's contents from a YAML file.
filename | YAML filename. |
rule | Ruleset for the saved game. |
Region * OpenXcom::SavedGame::locateRegion | ( | double | lon, |
double | lat | ||
) | const |
Locate a region containing a position.
Find the region containing this location.
lon | The longtitude. |
lat | The latitude. |
Locate a region containing a Target.
Find the region containing this target.
target | The target to locate. |
void OpenXcom::SavedGame::monthlyFunding | ( | ) |
Handles monthly funding.
Gives the player his monthly funds, taking in account all maintenance and profit costs.
void OpenXcom::SavedGame::save | ( | const std::string & | filename | ) | const |
Saves a saved game to YAML.
Saves a saved game's contents to a YAML file.
filename | YAML filename. |
void OpenXcom::SavedGame::setBattleGame | ( | SavedBattleGame * | battleGame | ) |
Sets the current battle game.
Set battleGame object.
battleGame | Pointer to the battleGame object. |
void OpenXcom::SavedGame::setDebugMode | ( | ) |
Sets debug mode.
Toggles debug mode.
void OpenXcom::SavedGame::setDifficulty | ( | GameDifficulty | difficulty | ) |
Sets the game difficulty.
Changes the game's difficulty to a new level.
difficulty | New difficulty. |
void OpenXcom::SavedGame::setFunds | ( | int | funds | ) |
Sets new funds.
Changes the player's funds to a new value.
funds | New funds. |
void OpenXcom::SavedGame::setGlobeLatitude | ( | double | lat | ) |
Sets the new globe latitude.
Changes the current latitude of the Geoscape globe.
lat | Latitude. |
void OpenXcom::SavedGame::setGlobeLongitude | ( | double | lon | ) |
Sets the new globe longitude.
Changes the current longitude of the Geoscape globe.
lon | Longitude. |
void OpenXcom::SavedGame::setGlobeZoom | ( | int | zoom | ) |
Sets the new globe zoom.
Changes the current zoom level of the Geoscape globe.
zoom | Zoom level. |
void OpenXcom::SavedGame::setGraphCountryToggles | ( | const std::string & | value | ) |
Sets the GraphCountryToggles.
value | The new value for GraphCountryToggles. |
void OpenXcom::SavedGame::setGraphFinanceToggles | ( | const std::string & | value | ) |
Sets the GraphFinanceToggles.
value | The new value for GraphFinanceToggles. |
void OpenXcom::SavedGame::setGraphRegionToggles | ( | const std::string & | value | ) |
Sets the GraphRegionToggles.
value | The new value for GraphRegionToggles. |
void OpenXcom::SavedGame::setIronman | ( | bool | ironman | ) |
Sets if the game is in ironman mode.
Changes if the game is set to ironman mode.
Ironman games cannot be manually saved.
ironman | Tony Stark |
void OpenXcom::SavedGame::setName | ( | const std::wstring & | name | ) |
Sets the game name.
Changes the game's name shown in Save screens.
name | New name. |
void OpenXcom::SavedGame::setSelectedBase | ( | size_t | base | ) |
Set the last selected player base.
Sets the last selected player base.
base | number of the base. |
void OpenXcom::SavedGame::setTime | ( | GameTime | time | ) |
void OpenXcom::SavedGame::setWarned | ( | bool | warned | ) |
sets whether or not the player has been warned
sets the player's "warned" status.
warned | set "warned" to this. |