mirror of https://github.com/OpenTTD/OpenTTD.git
Fix 7c6bf97: Don't change date and shift dates in the wrong order (#10711)
This commit is contained in:
parent
31ad990831
commit
2f495c015a
|
@ -112,13 +112,13 @@ static int32 ClickChangeDateCheat(int32 new_value, int32 change_direction)
|
||||||
ConvertDateToYMD(TimerGameCalendar::date, &ymd);
|
ConvertDateToYMD(TimerGameCalendar::date, &ymd);
|
||||||
Date new_date = ConvertYMDToDate(new_value, ymd.month, ymd.day);
|
Date new_date = ConvertYMDToDate(new_value, ymd.month, ymd.day);
|
||||||
|
|
||||||
/* Change the date. */
|
/* Shift cached dates before we change the date. */
|
||||||
TimerGameCalendar::SetDate(new_date, TimerGameCalendar::date_fract);
|
|
||||||
|
|
||||||
/* Shift cached dates. */
|
|
||||||
for (auto v : Vehicle::Iterate()) v->ShiftDates(new_date - TimerGameCalendar::date);
|
for (auto v : Vehicle::Iterate()) v->ShiftDates(new_date - TimerGameCalendar::date);
|
||||||
LinkGraphSchedule::instance.ShiftDates(new_date - TimerGameCalendar::date);
|
LinkGraphSchedule::instance.ShiftDates(new_date - TimerGameCalendar::date);
|
||||||
|
|
||||||
|
/* Now it's safe to actually change the date. */
|
||||||
|
TimerGameCalendar::SetDate(new_date, TimerGameCalendar::date_fract);
|
||||||
|
|
||||||
EnginesMonthlyLoop();
|
EnginesMonthlyLoop();
|
||||||
SetWindowDirty(WC_STATUS_BAR, 0);
|
SetWindowDirty(WC_STATUS_BAR, 0);
|
||||||
InvalidateWindowClassesData(WC_BUILD_STATION, 0);
|
InvalidateWindowClassesData(WC_BUILD_STATION, 0);
|
||||||
|
|
Loading…
Reference in New Issue