1
0
Fork 0

Codechange: Load check data is only interested in landscape and starting_year.

pull/13896/head
Peter Nelson 2025-03-25 20:58:49 +00:00 committed by Peter Nelson
parent df750d44fd
commit 7f3820fa7e
3 changed files with 13 additions and 8 deletions

View File

@ -39,7 +39,8 @@ struct LoadCheckData {
uint32_t map_size_y = 0;
TimerGameCalendar::Date current_date{};
GameSettings settings{};
LandscapeType landscape{}; ///< Landscape type.
TimerGameCalendar::Year starting_year{}; ///< Starting date.
CompanyPropertiesMap companies{}; ///< Company information.

View File

@ -54,7 +54,8 @@ void LoadCheckData::Clear()
this->map_size_x = this->map_size_y = 256; // Default for old savegames which do not store mapsize.
this->current_date = CalendarTime::MIN_DATE;
this->settings = {};
this->landscape = {};
this->starting_year = {};
companies.clear();
@ -558,9 +559,8 @@ public:
if (tr.top > tr.bottom) return;
/* Climate */
LandscapeType landscape = _load_check_data.settings.game_creation.landscape;
if (to_underlying(landscape) < NUM_LANDSCAPE) {
DrawString(tr, GetString(STR_NETWORK_SERVER_LIST_LANDSCAPE, STR_CLIMATE_TEMPERATE_LANDSCAPE + to_underlying(landscape)));
if (to_underlying(_load_check_data.landscape) < NUM_LANDSCAPE) {
DrawString(tr, GetString(STR_NETWORK_SERVER_LIST_LANDSCAPE, STR_CLIMATE_TEMPERATE_LANDSCAPE + to_underlying(_load_check_data.landscape)));
tr.top += GetCharacterHeight(FS_NORMAL);
}
@ -568,8 +568,8 @@ public:
if (tr.top > tr.bottom) return;
/* Start date (if available) */
if (_load_check_data.settings.game_creation.starting_year != 0) {
DrawString(tr, GetString(STR_NETWORK_SERVER_LIST_START_DATE, TimerGameCalendar::ConvertYMDToDate(_load_check_data.settings.game_creation.starting_year, 0, 1)));
if (_load_check_data.starting_year != 0) {
DrawString(tr, GetString(STR_NETWORK_SERVER_LIST_START_DATE, TimerGameCalendar::ConvertYMDToDate(_load_check_data.starting_year, 0, 1)));
tr.top += GetCharacterHeight(FS_NORMAL);
}
if (tr.top > tr.bottom) return;

View File

@ -164,7 +164,11 @@ struct PATSChunkHandler : ChunkHandler {
void LoadCheck(size_t) const override
{
LoadSettings(GetSaveLoadSettingTable(), &_load_check_data.settings, _settings_sl_compat);
GameSettings settings{};
LoadSettings(GetSaveLoadSettingTable(), &settings, _settings_sl_compat);
/* We're only interested in landscape and starting year. */
_load_check_data.landscape = settings.game_creation.landscape;
_load_check_data.starting_year = settings.game_creation.starting_year;
}
void Save() const override