@@ -104,24 +104,27 @@ static int32_t ClickChangeDateCheat(int3
/* Don't allow changing to an invalid year, or the current year. */
auto new_year = Clamp(TimerGameCalendar::Year(new_value), CalendarTime::MIN_YEAR, CalendarTime::MAX_YEAR);
if (new_year == TimerGameCalendar::year) return TimerGameCalendar::year.base();
TimerGameCalendar::YearMonthDay ymd = TimerGameCalendar::ConvertDateToYMD(TimerGameCalendar::date);
TimerGameCalendar::Date new_calendar_date = TimerGameCalendar::ConvertYMDToDate(new_year, ymd.month, ymd.day);
TimerGameCalendar::SetDate(new_calendar_date, TimerGameCalendar::date_fract);
/* If not using wallclock units, we keep economy date in sync with calendar date and must change it also. */
if (!TimerGameEconomy::UsingWallclockUnits()) {
/* Keep economy and calendar dates synced. */
TimerGameEconomy::Date new_economy_date = new_calendar_date.base();
/* Shift cached dates before we change the date. */
for (auto v : Vehicle::Iterate()) v->ShiftDates(new_economy_date - TimerGameEconomy::date);
LinkGraphSchedule::instance.ShiftDates(new_economy_date - TimerGameEconomy::date);
/* Now it's safe to actually change the date. */
if (!TimerGameEconomy::UsingWallclockUnits()) TimerGameEconomy::SetDate(new_economy_date, TimerGameEconomy::date_fract);
TimerGameEconomy::SetDate(new_economy_date, TimerGameEconomy::date_fract);
}
CalendarEnginesMonthlyLoop();
SetWindowDirty(WC_STATUS_BAR, 0);
InvalidateWindowClassesData(WC_BUILD_STATION, 0);
InvalidateWindowClassesData(WC_BUS_STATION, 0);
InvalidateWindowClassesData(WC_TRUCK_STATION, 0);
Status change: