|
@@ -36,13 +36,12 @@
|
|
|
#include "ai/ai.hpp"
|
|
|
#include "ai/ai_config.hpp"
|
|
|
#include "settings_func.h"
|
|
|
#include "genworld.h"
|
|
|
#include "progress.h"
|
|
|
#include "strings_func.h"
|
|
|
#include "date_func.h"
|
|
|
#include "vehicle_func.h"
|
|
|
#include "gamelog.h"
|
|
|
#include "animated_tile_func.h"
|
|
|
#include "roadstop_base.h"
|
|
|
#include "elrail_func.h"
|
|
|
#include "rev.h"
|
|
@@ -849,13 +848,13 @@ static void OnStartScenario()
|
|
|
{
|
|
|
/* Reset engine pool to simplify changing engine NewGRFs in scenario editor. */
|
|
|
EngineOverrideManager::ResetToCurrentNewGRFConfig();
|
|
|
|
|
|
/* Make sure all industries were built "this year", to avoid too early closures. (#9918) */
|
|
|
for (Industry *i : Industry::Iterate()) {
|
|
|
i->last_prod_year = _cur_year;
|
|
|
i->last_prod_year = TimerGameCalendar::year;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Triggers everything that should be triggered when starting a game.
|
|
|
* @param dedicated_server Whether this is a dedicated server or not.
|
|
@@ -1103,13 +1102,13 @@ void SwitchToMode(SwitchMode new_mode)
|
|
|
MarkWholeScreenDirty();
|
|
|
break;
|
|
|
|
|
|
case SM_LOAD_SCENARIO: { // Load scenario from scenario editor
|
|
|
if (SafeLoad(_file_to_saveload.name, _file_to_saveload.file_op, _file_to_saveload.detail_ftype, GM_EDITOR, NO_DIRECTORY)) {
|
|
|
SetLocalCompany(OWNER_NONE);
|
|
|
_settings_newgame.game_creation.starting_year = _cur_year;
|
|
|
_settings_newgame.game_creation.starting_year = TimerGameCalendar::year;
|
|
|
/* Cancel the saveload pausing */
|
|
|
Command<CMD_PAUSE>::Post(PM_PAUSED_SAVELOAD, false);
|
|
|
} else {
|
|
|
SetDParamStr(0, GetSaveLoadErrorString());
|
|
|
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_CRITICAL);
|
|
|
}
|
|
@@ -1387,16 +1386,16 @@ void StateGameLoop()
|
|
|
BasePersistentStorageArray::SwitchMode(PSM_LEAVE_GAMELOOP);
|
|
|
UpdateLandscapingLimits();
|
|
|
|
|
|
CallWindowGameTickEvent();
|
|
|
NewsLoop();
|
|
|
} else {
|
|
|
if (_debug_desync_level > 2 && _date_fract == 0 && (_date & 0x1F) == 0) {
|
|
|
if (_debug_desync_level > 2 && TimerGameCalendar::date_fract == 0 && (TimerGameCalendar::date & 0x1F) == 0) {
|
|
|
/* Save the desync savegame if needed. */
|
|
|
char name[MAX_PATH];
|
|
|
seprintf(name, lastof(name), "dmp_cmds_%08x_%08x.sav", _settings_game.game_creation.generation_seed, _date);
|
|
|
seprintf(name, lastof(name), "dmp_cmds_%08x_%08x.sav", _settings_game.game_creation.generation_seed, TimerGameCalendar::date);
|
|
|
SaveOrLoad(name, SLO_SAVE, DFT_GAME_FILE, AUTOSAVE_DIR, false);
|
|
|
}
|
|
|
|
|
|
CheckCaches();
|
|
|
|
|
|
/* All these actions has to be done from OWNER_NONE
|
|
@@ -1429,13 +1428,13 @@ void StateGameLoop()
|
|
|
assert(IsLocalCompany());
|
|
|
}
|
|
|
|
|
|
static IntervalTimer<TimerGameCalendar> _autosave_interval({TimerGameCalendar::MONTH, TimerGameCalendar::Priority::AUTOSAVE}, [](auto)
|
|
|
{
|
|
|
if (_settings_client.gui.autosave == 0) return;
|
|
|
if ((_cur_month % _autosave_months[_settings_client.gui.autosave]) != 0) return;
|
|
|
if ((TimerGameCalendar::month % _autosave_months[_settings_client.gui.autosave]) != 0) return;
|
|
|
|
|
|
_do_autosave = true;
|
|
|
SetWindowDirty(WC_STATUS_BAR, 0);
|
|
|
});
|
|
|
|
|
|
/**
|