19 #ifndef OPENXCOM_SAVEDGAME_H
20 #define OPENXCOM_SAVEDGAME_H
37 class SavedBattleGame;
41 class ResearchProject;
43 class RuleManufacture;
54 enum GameDifficulty { DIFF_BEGINNER = 0, DIFF_EXPERIENCED, DIFF_VETERAN, DIFF_GENIUS, DIFF_SUPERHUMAN };
59 enum SaveType { SAVE_DEFAULT, SAVE_QUICK, SAVE_AUTO_GEOSCAPE, SAVE_AUTO_BATTLESCAPE, SAVE_IRONMAN, SAVE_IRONMAN_END };
67 std::wstring displayName;
69 std::wstring isoDate, isoTime;
71 std::vector<std::string> rulesets;
87 std::vector<int> _funds, _maintenance, _researchScores, _incomes, _expenditures;
88 double _globeLon, _globeLat;
90 std::map<std::string, int> _ids;
91 std::vector<Country*> _countries;
92 std::vector<Region*> _regions;
93 std::vector<Base*> _bases;
94 std::vector<Ufo*> _ufos;
95 std::vector<Waypoint*> _waypoints;
96 std::vector<TerrorSite*> _terrorSites;
97 std::vector<AlienBase*> _alienBases;
100 std::vector<const RuleResearch *> _discovered;
101 std::vector<AlienMission*> _activeMissions;
102 bool _debug, _warned;
104 std::string _graphRegionToggles;
105 std::string _graphCountryToggles;
106 std::string _graphFinanceToggles;
107 std::vector<const RuleResearch *> _poppedResearch;
108 std::vector<Soldier*> _deadSoldiers;
109 size_t _selectedBase;
111 void getDependableResearchBasic (std::vector<RuleResearch *> & dependables,
const RuleResearch *research,
const Ruleset * ruleset,
Base * base)
const;
114 static const std::string AUTOSAVE_GEOSCAPE, AUTOSAVE_BATTLESCAPE, QUICKSAVE;
123 void load(
const std::string &filename,
Ruleset *rule);
125 void save(
const std::string &filename)
const;
129 void setName(
const std::wstring &name);
163 int getId(
const std::string &name);
173 const std::vector<Base*> *
getBases()
const;
203 bool isResearched(
const std::vector<std::string> &research)
const;
SaveType
Enumerator for the various save types.
Definition: SavedGame.h:59
std::vector< int > & getResearchScores()
gets the list of research scores
Definition: SavedGame.cpp:1481
void save(const std::string &filename) const
Saves a saved game to YAML.
Definition: SavedGame.cpp:449
std::vector< Base * > * getBases()
Gets the list of bases.
Definition: SavedGame.cpp:796
Stores the information about alien strategy.
Definition: AlienStrategy.h:32
const std::string & getGraphRegionToggles() const
Return the GraphRegionToggles.
Definition: SavedGame.cpp:1573
bool handlePromotions(std::vector< Soldier * > &participants)
Handles the higher promotions.
Definition: SavedGame.cpp:1282
void addFinishedResearch(const RuleResearch *r, const Ruleset *ruleset=NULL)
Add a finished ResearchProject.
Definition: SavedGame.cpp:901
void setDifficulty(GameDifficulty difficulty)
Sets the game difficulty.
Definition: SavedGame.cpp:582
void setGlobeZoom(int zoom)
Sets the new globe zoom.
Definition: SavedGame.cpp:691
void load(const std::string &filename, Ruleset *rule)
Loads a saved game from YAML.
Definition: SavedGame.cpp:289
double getGlobeLongitude() const
Gets the current globe longitude.
Definition: SavedGame.cpp:646
Represents an ongoing alien mission.
Definition: AlienMission.h:45
std::vector< Waypoint * > * getWaypoints()
Gets the list of waypoints.
Definition: SavedGame.cpp:863
void setGraphRegionToggles(const std::string &value)
Sets the GraphRegionToggles.
Definition: SavedGame.cpp:1598
bool isResearchAvailable(RuleResearch *r, const std::vector< const RuleResearch * > &unlocked, const Ruleset *ruleset) const
Check whether a ResearchProject can be researched.
Definition: SavedGame.cpp:1085
void setDebugMode()
Sets debug mode.
Definition: SavedGame.cpp:1412
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.
Definition: SavedGame.cpp:1151
int getCountryFunding() const
Gets the total country funding.
Definition: SavedGame.cpp:773
std::vector< int > getExpenditures()
gets the list of expenditures.
Definition: SavedGame.cpp:1499
SavedGame()
Creates a new saved game.
Definition: SavedGame.cpp:98
void setBattleGame(SavedBattleGame *battleGame)
Sets the current battle game.
Definition: SavedGame.cpp:890
The game data that gets written to disk when the game is saved.
Definition: SavedGame.h:80
void getAvailableResearchProjects(std::vector< RuleResearch * > &projects, const Ruleset *ruleset, Base *base) const
Get the list of ResearchProject which can be researched in a Base.
Definition: SavedGame.cpp:954
void setSelectedBase(size_t base)
Set the last selected player base.
Definition: SavedGame.cpp:822
const std::string & getGraphFinanceToggles() const
Return the GraphFinanceToggles.
Definition: SavedGame.cpp:1589
AlienStrategy & getAlienStrategy()
Full access to the alien strategy data.
Definition: SavedGame.h:231
bool isResearched(const std::string &research) const
Gets if a research has been unlocked.
Definition: SavedGame.cpp:1217
double getGlobeLatitude() const
Gets the current globe latitude.
Definition: SavedGame.cpp:664
GameDifficulty getDifficulty() const
Gets the game difficulty.
Definition: SavedGame.cpp:573
Soldier * getSoldier(int id) const
Gets the soldier matching this ID.
Definition: SavedGame.cpp:1262
int getSoldierScore(Soldier *soldier)
Evaluate the score of a soldier based on all of his stats, missions and kills.
Definition: SavedGame.cpp:1390
int getMonthsPassed() const
Return the month counter.
Definition: SavedGame.cpp:1565
int getId(const std::string &name)
Gets the current ID for an object.
Definition: SavedGame.cpp:746
void setTime(GameTime time)
Sets the current game time.
Definition: SavedGame.cpp:735
bool wasResearchPopped(const RuleResearch *research)
check if a research is on the "popped up" array
Definition: SavedGame.cpp:1644
std::vector< Soldier * > * getDeadSoldiers()
Gets the list of dead soldiers.
Definition: SavedGame.cpp:1666
std::wstring getName() const
Gets the game name.
Definition: SavedGame.cpp:555
void setGraphFinanceToggles(const std::string &value)
Sets the GraphFinanceToggles.
Definition: SavedGame.cpp:1616
GameDifficulty
Enumerator containing all the possible game difficulties.
Definition: SavedGame.h:54
Contains strings used throughout the game for localization.
Definition: Language.h:42
Base * getSelectedBase()
Gets the last selected player base.
Definition: SavedGame.cpp:805
void addPoppedResearch(const RuleResearch *research)
add a research to the "popped up" array
Definition: SavedGame.cpp:1633
void monthlyFunding()
Handles monthly funding.
Definition: SavedGame.cpp:700
std::vector< int > getMaintenances()
return a list of maintenance costs
Definition: SavedGame.cpp:1463
SavedBattleGame * getSavedBattle()
Gets the current battle game.
Definition: SavedGame.cpp:881
int getFunds() const
Gets the current funds.
Definition: SavedGame.cpp:611
~SavedGame()
Cleans up the saved game.
Definition: SavedGame.cpp:112
const std::vector< int > & getFundsList() const
Gets the list of funds from previous months.
Definition: SavedGame.cpp:620
Set of rules and stats for a game.
Definition: Ruleset.h:69
std::vector< Region * > * getRegions()
Gets the list of regions.
Definition: SavedGame.cpp:787
static std::vector< SaveInfo > getList(Language *lang, bool autoquick)
Gets list of saves in the user directory.
Definition: SavedGame.cpp:161
void setWarned(bool warned)
sets whether or not the player has been warned
Definition: SavedGame.cpp:1517
int getBaseMaintenance() const
Gets the total base maintenance.
Definition: SavedGame.cpp:840
void setFunds(int funds)
Sets new funds.
Definition: SavedGame.cpp:629
void setName(const std::wstring &name)
Sets the game name.
Definition: SavedGame.cpp:564
std::vector< int > getIncomes()
gets the list of incomes.
Definition: SavedGame.cpp:1490
const std::vector< const RuleResearch * > & getDiscoveredResearch() const
Get the list of already discovered research projects.
Definition: SavedGame.cpp:943
Stores the current ingame time/date according to GMT.
Definition: GameTime.h:40
Represents a soldier hired by the player.
Definition: Soldier.h:49
bool isIronman() const
Gets if the game is in ironman mode.
Definition: SavedGame.cpp:592
void setGlobeLatitude(double lat)
Sets the new globe latitude.
Definition: SavedGame.cpp:673
std::vector< AlienBase * > * getAlienBases()
Returns the list of alien bases.
Definition: SavedGame.cpp:1404
Represents a player base on the globe.
Definition: Base.h:47
bool getWarned() const
gets whether or not the player has been warned
Definition: SavedGame.cpp:1508
void addMonth()
Increment the month counter.
Definition: SavedGame.cpp:1624
int getGlobeZoom() const
Gets the current globe zoom.
Definition: SavedGame.cpp:682
const std::string & getGraphCountryToggles() const
Return the GraphCountryToggles.
Definition: SavedGame.cpp:1581
Represents one research project.
Definition: RuleResearch.h:40
GameTime * getTime() const
Gets the current game time.
Definition: SavedGame.cpp:726
bool getDebugMode() const
Gets debug mode.
Definition: SavedGame.cpp:1421
void removePoppedResearch(const RuleResearch *research)
remove a research from the "popped up" array
Definition: SavedGame.cpp:1653
std::vector< AlienMission * > & getAlienMissions()
Full access to the current alien missions.
Definition: SavedGame.h:235
void setGraphCountryToggles(const std::string &value)
Sets the GraphCountryToggles.
Definition: SavedGame.cpp:1607
The battlescape data that gets written to disk when the game is saved.
Definition: SavedBattleGame.h:50
void getAvailableProductions(std::vector< RuleManufacture * > &productions, const Ruleset *ruleset, Base *base) const
Get the list of Productions which can be manufactured in a Base.
Definition: SavedGame.cpp:1056
Represents a region of the world.
Definition: Region.h:35
std::vector< Ufo * > * getUfos()
Gets the list of UFOs.
Definition: SavedGame.cpp:854
const AlienStrategy & getAlienStrategy() const
Read-only access to the alien strategy data.
Definition: SavedGame.h:233
void setGlobeLongitude(double lon)
Sets the new globe longitude.
Definition: SavedGame.cpp:655
void inspectSoldiers(Soldier **highestRanked, size_t *total, int rank)
Checks how many soldiers of a rank exist and which one has the highest score.
Definition: SavedGame.cpp:1349
Region * locateRegion(double lon, double lat) const
Locate a region containing a position.
Definition: SavedGame.cpp:1542
Base class for targets on the globe with a set of radian coordinates.
Definition: Target.h:35
void addResearchScore(int score)
sets the research score for the month
Definition: SavedGame.cpp:1472
std::vector< Country * > * getCountries()
Gets the list of countries.
Definition: SavedGame.cpp:764
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.
Definition: SavedGame.cpp:1198
std::vector< TerrorSite * > * getTerrorSites()
Gets the list of terror sites.
Definition: SavedGame.cpp:872
Container for savegame info displayed on listings.
Definition: SavedGame.h:64
const std::vector< AlienMission * > & getAlienMissions() const
Read-only access to the current alien missions.
Definition: SavedGame.h:237
void setIronman(bool ironman)
Sets if the game is in ironman mode.
Definition: SavedGame.cpp:602
AlienMission * getAlienMission(const std::string ®ion, const std::string &type) const
Gets a mission matching region and type.
Definition: SavedGame.cpp:1451