Codechange: Move calendar date functions inside TimerGameCalendar (#10753)

This commit is contained in:
Tyler Trahan
2023-05-04 09:14:12 -04:00
committed by GitHub
parent 7669aac865
commit 6501f84b4a
43 changed files with 224 additions and 281 deletions

View File

@@ -81,6 +81,19 @@ public:
using Month = uint8; ///< Type for the month, note: 0 based, i.e. 0 = January, 11 = December.
using Day = uint8; ///< Type for the day of the month, note: 1 based, first day of a month is 1.
/**
* Data structure to convert between Date and triplet (year, month, and day).
* @see TimerGameCalendar::ConvertDateToYMD(), TimerGameCalendar::ConvertYMDToDate()
*/
struct YearMonthDay {
Year year; ///< Year (0...)
Month month; ///< Month (0..11)
Day day; ///< Day (1..31)
};
static bool IsLeapYear(TimerGameCalendar::Year yr);
static void ConvertDateToYMD(TimerGameCalendar::Date date, YearMonthDay *ymd);
static TimerGameCalendar::Date ConvertYMDToDate(TimerGameCalendar::Year year, TimerGameCalendar::Month month, TimerGameCalendar::Day day);
static void SetDate(TimerGameCalendar::Date date, TimerGameCalendar::DateFract fract);
static Year year; ///< Current year, starting at 0.