Changeset - r28798:14d02a6bd083
[Not reviewed]
master
0 1 0
Jonathan G Rennison - 10 months ago 2024-02-20 23:56:46
j.g.rennison@gmail.com
Fix #12145: Incorrect date handling in date cheat in wallclock time-keeping mode
1 file changed with 7 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/cheat_gui.cpp
Show inline comments
 
@@ -107,6 +107,11 @@ static int32_t ClickChangeDateCheat(int3
 

	
 
	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();
 

	
 
@@ -115,10 +120,8 @@ static int32_t ClickChangeDateCheat(int3
 
	LinkGraphSchedule::instance.ShiftDates(new_economy_date - TimerGameEconomy::date);
 

	
 
	/* Now it's safe to actually change the date. */
 
	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()) TimerGameEconomy::SetDate(new_economy_date, TimerGameEconomy::date_fract);
 
		TimerGameEconomy::SetDate(new_economy_date, TimerGameEconomy::date_fract);
 
	}
 

	
 
	CalendarEnginesMonthlyLoop();
 
	SetWindowDirty(WC_STATUS_BAR, 0);
0 comments (0 inline, 0 general)