Change gamelog to use std::vector

Move LoadCheckData to its own header
This commit is contained in:
Jonathan G Rennison
2023-07-03 22:42:28 +01:00
parent 5ae5ac3701
commit 0bf41dc1ff
23 changed files with 212 additions and 228 deletions

View File

@@ -23,73 +23,6 @@ enum SaveLoadInvalidateWindowData {
SLIWD_FILTER_CHANGES, ///< The filename filter has changed (via the editbox)
};
using CompanyPropertiesMap = std::map<uint, std::unique_ptr<CompanyProperties>>;
/**
* Container for loading in mode SL_LOAD_CHECK.
*/
struct LoadCheckData {
bool checkable; ///< True if the savegame could be checked by SL_LOAD_CHECK. (Old savegames are not checkable.)
StringID error; ///< Error message from loading. INVALID_STRING_ID if no error.
std::string error_msg; ///< Data to pass to SetDParamStr when displaying #error.
uint32 map_size_x, map_size_y;
Date current_date;
GameSettings settings;
CompanyPropertiesMap companies; ///< Company information.
GRFConfig *grfconfig; ///< NewGrf configuration from save.
bool want_grf_compatibility = true;
GRFListCompatibility grf_compatibility; ///< Summary state of NewGrfs, whether missing files or only compatible found.
struct LoggedAction *gamelog_action; ///< Gamelog actions
uint gamelog_actions; ///< Number of gamelog actions
bool want_debug_data = false;
std::string debug_log_data;
std::string debug_config_data;
bool sl_is_ext_version = false;
LoadCheckData() : grfconfig(nullptr),
grf_compatibility(GLC_NOT_FOUND), gamelog_action(nullptr), gamelog_actions(0)
{
this->Clear();
}
/**
* Don't leak memory at program exit
*/
~LoadCheckData()
{
this->Clear();
}
/**
* Check whether loading the game resulted in errors.
* @return true if errors were encountered.
*/
bool HasErrors()
{
return this->checkable && this->error != INVALID_STRING_ID;
}
/**
* Check whether the game uses any NewGrfs.
* @return true if NewGrfs are used.
*/
bool HasNewGrfs()
{
return this->checkable && this->error == INVALID_STRING_ID && this->grfconfig != nullptr;
}
void Clear();
};
extern LoadCheckData _load_check_data;
/** Deals with finding savegames */
struct FiosItem {
FiosType type;