Fix #14375: When loading config, validate timekeeping mode and minutes per year (#14405)

This commit is contained in:
Tyler Trahan
2025-07-09 16:04:38 -04:00
committed by GitHub
parent 753905ae2d
commit 259830777c
2 changed files with 11 additions and 0 deletions

View File

@@ -667,6 +667,15 @@ static void ChangeMinutesPerYear(int32_t new_value)
}
}
/* Get the valid range of the "minutes per calendar year" setting. */
static std::tuple<int32_t, uint32_t> GetMinutesPerYearRange(const IntSettingDesc &)
{
/* Allow a non-default value only if using Wallclock timekeeping units. */
if (_settings_newgame.economy.timekeeping_units == TKU_WALLCLOCK) return { CalendarTime::FROZEN_MINUTES_PER_YEAR, CalendarTime::MAX_MINUTES_PER_YEAR };
return { CalendarTime::DEF_MINUTES_PER_YEAR, CalendarTime::DEF_MINUTES_PER_YEAR };
}
/**
* Pre-callback check when trying to change the timetable mode. This is locked to Seconds when using wallclock units.
* @param Unused.