Codechange: Move calendar date functions inside TimerGameCalendar (#10753)

This commit is contained in:
Tyler Trahan
2023-05-04 09:14:12 -04:00
committed by GitHub
parent 7669aac865
commit 6501f84b4a
43 changed files with 224 additions and 281 deletions

View File

@@ -17,8 +17,6 @@
#include "rail_gui.h"
#include "road.h"
#include "road_gui.h"
#include "date_func.h"
#include "timer/timer_game_calendar.h"
#include "vehicle_func.h"
#include "sound_func.h"
#include "terraform_gui.h"
@@ -56,6 +54,7 @@
#include "league_base.h"
#include "timer/timer.h"
#include "timer/timer_window.h"
#include "timer/timer_game_calendar.h"
#include "widgets/toolbar_widget.h"
@@ -1148,7 +1147,7 @@ void ToggleDirtyBlocks()
void SetStartingYear(TimerGameCalendar::Year year)
{
_settings_game.game_creation.starting_year = Clamp(year, MIN_YEAR, MAX_YEAR);
TimerGameCalendar::Date new_date = ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1);
TimerGameCalendar::Date new_date = TimerGameCalendar::ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1);
/* If you open a savegame as scenario there may already be link graphs.*/
LinkGraphSchedule::instance.ShiftDates(new_date - TimerGameCalendar::date);
TimerGameCalendar::SetDate(new_date, 0);
@@ -2377,7 +2376,7 @@ struct ScenarioEditorToolbarWindow : Window {
{
switch (widget) {
case WID_TE_DATE:
SetDParam(0, ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1));
SetDParam(0, TimerGameCalendar::ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1));
break;
}
}
@@ -2406,7 +2405,7 @@ struct ScenarioEditorToolbarWindow : Window {
break;
case WID_TE_DATE:
SetDParam(0, ConvertYMDToDate(MAX_YEAR, 0, 1));
SetDParam(0, TimerGameCalendar::ConvertYMDToDate(MAX_YEAR, 0, 1));
*size = GetStringBoundingBox(STR_WHITE_DATE_LONG);
break;
}