26 #include "../Mod/RuleAlienMission.h" 27 #include "../Savegame/Craft.h" 39 class SavedBattleGame;
43 class ResearchProject;
45 class RuleManufacture;
53 struct MissionStatistics;
54 struct BattleUnitKills;
59 enum GameDifficulty { DIFF_BEGINNER = 0, DIFF_EXPERIENCED, DIFF_VETERAN, DIFF_GENIUS, DIFF_SUPERHUMAN };
64 enum SaveType { SAVE_DEFAULT, SAVE_QUICK, SAVE_AUTO_GEOSCAPE, SAVE_AUTO_BATTLESCAPE, SAVE_IRONMAN, SAVE_IRONMAN_END };
69 enum GameEnding { END_NONE, END_WIN, END_LOSE };
77 std::string displayName;
79 std::string isoDate, isoTime;
81 std::vector<std::string> mods;
91 PromotionInfo(): totalCommanders(0), totalColonels(0), totalCaptains(0), totalSergeants(0){}
103 GameDifficulty _difficulty;
107 std::vector<int> _researchScores;
108 std::vector<int64_t> _funds, _maintenance, _incomes, _expenditures;
109 double _globeLon, _globeLat;
111 std::map<std::string, int> _ids;
112 std::vector<Country*> _countries;
113 std::vector<Region*> _regions;
114 std::vector<Base*> _bases;
115 std::vector<Ufo*> _ufos;
116 std::vector<Waypoint*> _waypoints;
117 std::vector<MissionSite*> _missionSites;
118 std::vector<AlienBase*> _alienBases;
121 std::vector<const RuleResearch*> _discovered;
122 std::vector<AlienMission*> _activeMissions;
123 bool _debug, _warned;
125 std::string _graphRegionToggles;
126 std::string _graphCountryToggles;
127 std::string _graphFinanceToggles;
128 std::vector<const RuleResearch*> _poppedResearch;
129 std::vector<Soldier*> _deadSoldiers;
130 size_t _selectedBase;
131 std::string _lastselectedArmor;
132 std::vector<MissionStatistics*> _missionStatistics;
136 static const std::string AUTOSAVE_GEOSCAPE, AUTOSAVE_BATTLESCAPE, QUICKSAVE;
146 void load(
const std::string &filename,
Mod *mod);
148 void save(
const std::string &filename)
const;
152 void setName(
const std::string &name);
192 int getId(
const std::string &name);
194 const std::map<std::string, int> &
getAllIds()
const;
196 void setAllIds(
const std::map<std::string, int> &ids);
206 const std::vector<Base*> *
getBases()
const;
236 bool isResearched(
const std::string &research,
bool considerDebugMode =
true)
const;
238 bool isResearched(
const std::vector<std::string> &research,
bool considerDebugMode =
true)
const;
std::vector< int > & getResearchScores()
gets the list of research scores
Definition: SavedGame.cpp:1734
Represents a craft stored in a base.
Definition: Craft.h:45
std::vector< Base * > * getBases()
Gets the list of bases.
Definition: SavedGame.cpp:980
Stores the information about alien strategy.
Definition: AlienStrategy.h:31
void setLastSelectedArmor(const std::string &value)
Sets the last selected armour.
Definition: SavedGame.cpp:1930
int getBaseMaintenance() const
Gets the total base maintenance.
Definition: SavedGame.cpp:1024
void setDifficulty(GameDifficulty difficulty)
Sets the game difficulty.
Definition: SavedGame.cpp:720
void setGlobeZoom(int zoom)
Sets the new globe zoom.
Definition: SavedGame.cpp:857
void getAvailableProductions(std::vector< RuleManufacture *> &productions, const Mod *mod, Base *base) const
Get the list of Productions which can be manufactured in a Base.
Definition: SavedGame.cpp:1337
void getDependableManufacture(std::vector< RuleManufacture *> &dependables, const RuleResearch *research, const Mod *mod, Base *base) const
Get the list of newly available manufacture projects once a research has been completed.
Definition: SavedGame.cpp:1366
void getAvailableResearchProjects(std::vector< RuleResearch *> &projects, const Mod *mod, Base *base, bool considerDebugMode=false) const
Get the list of ResearchProject which can be researched in a Base.
Definition: SavedGame.cpp:1219
Represents an ongoing alien mission.
Definition: AlienMission.h:46
std::vector< Waypoint * > * getWaypoints()
Gets the list of waypoints.
Definition: SavedGame.cpp:1047
const std::vector< const RuleResearch * > & getDiscoveredResearch() const
Get the list of already discovered research projects.
Definition: SavedGame.cpp:1207
void setGraphRegionToggles(const std::string &value)
Sets the GraphRegionToggles.
Definition: SavedGame.cpp:1852
std::vector< int64_t > & getExpenditures()
gets the list of expenditures.
Definition: SavedGame.cpp:1752
const std::vector< AlienMission * > & getAlienMissions() const
Read-only access to the current alien missions.
Definition: SavedGame.h:274
double getGlobeLongitude() const
Gets the current globe longitude.
Definition: SavedGame.cpp:812
void setDebugMode()
Sets debug mode.
Definition: SavedGame.cpp:1665
void addFinishedResearchSimple(const RuleResearch *research)
Add a finished ResearchProject.
Definition: SavedGame.cpp:1084
const std::string & getGraphRegionToggles() const
Return the GraphRegionToggles.
Definition: SavedGame.cpp:1827
std::string getLastSelectedArmor() const
Gets the last selected armour.
Definition: SavedGame.cpp:1939
void setEnding(GameEnding end)
Sets the game ending.
Definition: SavedGame.cpp:748
SavedGame()
Creates a new saved game.
Definition: SavedGame.cpp:101
double getGlobeLatitude() const
Gets the current globe latitude.
Definition: SavedGame.cpp:830
void setBattleGame(SavedBattleGame *battleGame)
Sets the current battle game.
Definition: SavedGame.cpp:1074
The game data that gets written to disk when the game is saved.
Definition: SavedGame.h:99
void setSelectedBase(size_t base)
Set the last selected player base.
Definition: SavedGame.cpp:1006
AlienStrategy & getAlienStrategy()
Full access to the alien strategy data.
Definition: SavedGame.h:268
void save(const std::string &filename) const
Saves a saved game to YAML.
Definition: SavedGame.cpp:562
Contains all the game-specific static data that never changes throughout the game, like rulesets and resources.
Definition: Mod.h:87
const AlienStrategy & getAlienStrategy() const
Read-only access to the alien strategy data.
Definition: SavedGame.h:270
void setFunds(int64_t funds)
Sets new funds.
Definition: SavedGame.cpp:795
GameEnding getEnding() const
Gets the game ending.
Definition: SavedGame.cpp:739
int getSoldierScore(Soldier *soldier)
Evaluate the score of a soldier based on all of his stats, missions and kills.
Definition: SavedGame.cpp:1643
std::vector< int64_t > & getMaintenances()
return a list of maintenance costs
Definition: SavedGame.cpp:1716
bool getDebugMode() const
Gets debug mode.
Definition: SavedGame.cpp:1674
int getId(const std::string &name)
Gets the current ID for an object.
Definition: SavedGame.cpp:912
static std::string sanitizeModName(const std::string &name)
Sanitizies a mod name in a save.
Definition: SavedGame.cpp:169
Container for battle unit kills statistics.
Definition: BattleUnitStatistics.h:32
Craft * findCraftByUniqueId(const CraftId &craftId) const
Returns the craft corresponding to the specified unique id.
Definition: SavedGame.cpp:1949
void processSoldier(Soldier *soldier, PromotionInfo &soldierData)
Processes a soldier's promotion.
Definition: SavedGame.cpp:1591
bool wasResearchPopped(const RuleResearch *research)
check if a research is on the "popped up" array
Definition: SavedGame.cpp:1898
GameTime * getTime() const
Gets the current game time.
Definition: SavedGame.cpp:892
Soldier * inspectSoldiers(std::vector< Soldier *> &soldiers, std::vector< Soldier *> &participants, int rank)
Checks how many soldiers of a rank exist and which one has the highest score.
Definition: SavedGame.cpp:1619
int getDifficultyCoefficient() const
Gets the game difficulty coefficient.
Definition: SavedGame.cpp:730
const std::string & getGraphFinanceToggles() const
Return the GraphFinanceToggles.
Definition: SavedGame.cpp:1843
std::vector< int64_t > & getIncomes()
gets the list of incomes.
Definition: SavedGame.cpp:1743
std::vector< Soldier * > * getDeadSoldiers()
Gets the list of dead soldiers.
Definition: SavedGame.cpp:1920
void setGraphFinanceToggles(const std::string &value)
Sets the GraphFinanceToggles.
Definition: SavedGame.cpp:1870
Soldier * getSoldier(int id) const
Gets the soldier matching this ID.
Definition: SavedGame.cpp:1459
Contains strings used throughout the game for localization.
Definition: Language.h:39
Base * getSelectedBase()
Gets the last selected player base.
Definition: SavedGame.cpp:989
void addPoppedResearch(const RuleResearch *research)
add a research to the "popped up" array
Definition: SavedGame.cpp:1887
void monthlyFunding()
Handles monthly funding.
Definition: SavedGame.cpp:866
int getGlobeZoom() const
Gets the current globe zoom.
Definition: SavedGame.cpp:848
SavedBattleGame * getSavedBattle()
Gets the current battle game.
Definition: SavedGame.cpp:1065
~SavedGame()
Cleans up the saved game.
Definition: SavedGame.cpp:116
std::vector< Region * > * getRegions()
Gets the list of regions.
Definition: SavedGame.cpp:971
static std::vector< SaveInfo > getList(Language *lang, bool autoquick)
Gets list of saves in the user directory.
Definition: SavedGame.cpp:218
void setWarned(bool warned)
sets whether or not the player has been warned
Definition: SavedGame.cpp:1771
void setName(const std::string &name)
Sets the game name.
Definition: SavedGame.cpp:702
int getCountryFunding() const
Gets the total country funding.
Definition: SavedGame.cpp:957
Stores the current ingame time/date according to GMT.
Definition: GameTime.h:38
Represents a soldier hired by the player.
Definition: Soldier.h:48
void setTime(const GameTime &time)
Sets the current game time.
Definition: SavedGame.cpp:901
std::vector< Soldier * >::iterator killSoldier(Soldier *soldier, BattleUnitKills *cause=0)
Handles a soldier's death.
Definition: SavedGame.cpp:1977
void setGlobeLatitude(double lat)
Sets the new globe latitude.
Definition: SavedGame.cpp:839
std::vector< AlienBase * > * getAlienBases()
Returns the list of alien bases.
Definition: SavedGame.cpp:1657
Represents a player base on the globe.
Definition: Base.h:45
void addMonth()
Increment the month counter.
Definition: SavedGame.cpp:1878
Represents one research project.
Definition: RuleResearch.h:38
void getNewlyAvailableResearchProjects(std::vector< RuleResearch *> &before, std::vector< RuleResearch *> &after, std::vector< RuleResearch *> &diff) const
Get the list of newly available research projects once a research has been completed.
Definition: SavedGame.cpp:1314
void removePoppedResearch(const RuleResearch *research)
remove a research from the "popped up" array
Definition: SavedGame.cpp:1907
Region * locateRegion(double lon, double lat) const
Locate a region containing a position.
Definition: SavedGame.cpp:1796
std::vector< AlienMission * > & getAlienMissions()
Full access to the current alien missions.
Definition: SavedGame.h:272
bool hasUndiscoveredProtectedUnlock(const RuleResearch *r, const Mod *mod) const
Gets if a research still has undiscovered "protected unlocks".
Definition: SavedGame.cpp:1386
const std::string & getGraphCountryToggles() const
Return the GraphCountryToggles.
Definition: SavedGame.cpp:1835
AlienMission * findAlienMission(const std::string ®ion, MissionObjective objective) const
Finds a mission by region and objective.
Definition: SavedGame.cpp:1704
bool handlePromotions(std::vector< Soldier *> &participants)
Handles the higher promotions.
Definition: SavedGame.cpp:1486
void addFinishedResearch(const RuleResearch *research, const Mod *mod, Base *base, bool score=true)
Add a finished ResearchProject.
Definition: SavedGame.cpp:1096
std::vector< int64_t > & getFundsList()
Gets the list of funds from previous months.
Definition: SavedGame.cpp:786
std::vector< MissionStatistics * > * getMissionStatistics()
Gets the list of missions statistics.
Definition: SavedGame.cpp:1967
void setGraphCountryToggles(const std::string &value)
Sets the GraphCountryToggles.
Definition: SavedGame.cpp:1861
The battlescape data that gets written to disk when the game is saved.
Definition: SavedBattleGame.h:47
bool isIronman() const
Gets if the game is in ironman mode.
Definition: SavedGame.cpp:758
GameDifficulty getDifficulty() const
Gets the game difficulty.
Definition: SavedGame.cpp:711
Represents a region of the world.
Definition: Region.h:33
std::vector< Ufo * > * getUfos()
Gets the list of UFOs.
Definition: SavedGame.cpp:1038
void setAllIds(const std::map< std::string, int > &ids)
Resets the list of object IDs.
Definition: SavedGame.cpp:939
std::string getName() const
Gets the game name.
Definition: SavedGame.cpp:693
void setGlobeLongitude(double lon)
Sets the new globe longitude.
Definition: SavedGame.cpp:821
void load(const std::string &filename, Mod *mod)
Loads a saved game from YAML.
Definition: SavedGame.cpp:331
std::vector< MissionSite * > * getMissionSites()
Gets the list of mission sites.
Definition: SavedGame.cpp:1056
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:1725
std::vector< Country * > * getCountries()
Gets the list of countries.
Definition: SavedGame.cpp:948
bool isResearched(const std::string &research, bool considerDebugMode=true) const
Gets if a certain research has been completed.
Definition: SavedGame.cpp:1409
int getMonthsPassed() const
Return the month counter.
Definition: SavedGame.cpp:1819
const std::map< std::string, int > & getAllIds() const
Resets the list of object IDs.
Definition: SavedGame.cpp:930
int64_t getFunds() const
Gets the current funds.
Definition: SavedGame.cpp:777
bool getWarned() const
gets whether or not the player has been warned
Definition: SavedGame.cpp:1762
Container for savegame info displayed on listings.
Definition: SavedGame.h:74
Definition: BaseInfoState.cpp:40
void setIronman(bool ironman)
Sets if the game is in ironman mode.
Definition: SavedGame.cpp:768