Allow setting autosave interval to a custom number of days

This commit is contained in:
Jonathan G Rennison
2021-12-14 18:08:06 +00:00
parent 670dbc739d
commit 583663bca1
7 changed files with 87 additions and 6 deletions

View File

@@ -249,7 +249,7 @@ static void OnNewYear()
*/
static void OnNewMonth()
{
if (_settings_client.gui.autosave != 0 && (_cur_date_ymd.month % _autosave_months[_settings_client.gui.autosave]) == 0) {
if (_settings_client.gui.autosave != 0 && _settings_client.gui.autosave < 5 && (_cur_date_ymd.month % _autosave_months[_settings_client.gui.autosave]) == 0) {
_do_autosave = true;
_check_special_modes = true;
SetWindowDirty(WC_STATUS_BAR, 0);
@@ -271,6 +271,12 @@ static void OnNewMonth()
*/
static void OnNewDay()
{
if (_settings_client.gui.autosave == 5 && (_date % _settings_client.gui.autosave_custom_days) == 0) {
_do_autosave = true;
_check_special_modes = true;
SetWindowDirty(WC_STATUS_BAR, 0);
}
if (!_newgrf_profilers.empty() && _newgrf_profile_end_date <= _date) {
NewGRFProfiler::FinishAll();
}