1
0
Fork 0

Codechange: Sync economy and calendar dates when starting a new game

pull/11588/head
Tyler Trahan 2023-04-29 10:40:06 -04:00
parent fd20ada1f9
commit 0a12ba9584
1 changed files with 5 additions and 1 deletions

View File

@ -16,6 +16,7 @@
#include "newgrf_house.h" #include "newgrf_house.h"
#include "economy_func.h" #include "economy_func.h"
#include "timer/timer_game_calendar.h" #include "timer/timer_game_calendar.h"
#include "timer/timer_game_economy.h"
#include "timer/timer_game_tick.h" #include "timer/timer_game_tick.h"
#include "texteff.hpp" #include "texteff.hpp"
#include "gfx_func.h" #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(); _newgrf_profilers.clear();
if (reset_date) { 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(); InitializeOldNames();
} }