From 0a12ba95849557137cf799ce8f638701d362b1d4 Mon Sep 17 00:00:00 2001 From: Tyler Trahan Date: Sat, 29 Apr 2023 10:40:06 -0400 Subject: [PATCH] Codechange: Sync economy and calendar dates when starting a new game --- src/misc.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/misc.cpp b/src/misc.cpp index a22abe3121..1d7824a267 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -16,6 +16,7 @@ #include "newgrf_house.h" #include "economy_func.h" #include "timer/timer_game_calendar.h" +#include "timer/timer_game_economy.h" #include "timer/timer_game_tick.h" #include "texteff.hpp" #include "gfx_func.h" @@ -110,7 +111,10 @@ void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settin _newgrf_profilers.clear(); if (reset_date) { - TimerGameCalendar::SetDate(TimerGameCalendar::ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1), 0); + TimerGameCalendar::Date new_date = TimerGameCalendar::ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1); + TimerGameCalendar::SetDate(new_date, 0); + /* Keep the economy date synced with the calendar date. */ + TimerGameEconomy::SetDate(new_date.base(), 0); InitializeOldNames(); }