Codechange: Add a DateToYear function instead of dividing each time (#11173)
This commit is contained in:
@@ -63,6 +63,16 @@ static constexpr TimerGameCalendar::Date DateAtStartOfYear(TimerGameCalendar::Ye
|
||||
return (DAYS_IN_YEAR * year) + number_of_leap_years;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the year of a given date.
|
||||
* @param date The date to consider.
|
||||
* @return the year.
|
||||
*/
|
||||
static inline TimerGameCalendar::Year DateToYear(TimerGameCalendar::Date date)
|
||||
{
|
||||
return date / DAYS_IN_LEAP_YEAR;
|
||||
}
|
||||
|
||||
/**
|
||||
* The date of the first day of the original base year.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user