Changeset - r28797:b0e955ab5da2
[Not reviewed]
master
0 1 0
Jonathan G Rennison - 2 months ago 2024-02-20 20:01:33
j.g.rennison@gmail.com
Codefix: Off by one in TimerGameEconomy::ConvertDateToYMD wallclock mode
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/timer/timer_game_economy.cpp
Show inline comments
 
@@ -49,13 +49,13 @@ TimerGameEconomy::DateFract TimerGameEco
 
	if (!UsingWallclockUnits()) return CalendarConvertDateToYMD(date);
 

	
 
	/* If we're using wallclock units, economy months have 30 days and an economy year has 360 days. */
 
	TimerGameEconomy::YearMonthDay ymd;
 
	ymd.year = date.base() / EconomyTime::DAYS_IN_ECONOMY_YEAR;
 
	ymd.month = (date.base() % EconomyTime::DAYS_IN_ECONOMY_YEAR) / EconomyTime::DAYS_IN_ECONOMY_MONTH;
 
	ymd.day = date.base() % EconomyTime::DAYS_IN_ECONOMY_MONTH;
 
	ymd.day = (date.base() % EconomyTime::DAYS_IN_ECONOMY_MONTH) + 1;
 
	return ymd;
 
}
 

	
 
/**
 
 * Converts a tuple of Year, Month and Day to a Date.
 
 * @param year  is a number between 0..MAX_YEAR
0 comments (0 inline, 0 general)