Codechange: make TimerGameCalendar Date and Year types strongly typed (#10761)

This commit is contained in:
Patric Stout
2023-08-12 20:14:21 +02:00
committed by GitHub
parent 0238a2b567
commit 299570b2c1
55 changed files with 390 additions and 203 deletions

View File

@@ -22,7 +22,7 @@
/* static */ ScriptDate::Date ScriptDate::GetCurrentDate()
{
return (ScriptDate::Date)TimerGameCalendar::date;
return (ScriptDate::Date)(int32_t)TimerGameCalendar::date;
}
/* static */ SQInteger ScriptDate::GetYear(ScriptDate::Date date)
@@ -31,7 +31,7 @@
::TimerGameCalendar::YearMonthDay ymd;
::TimerGameCalendar::ConvertDateToYMD(date, &ymd);
return ymd.year;
return (int32_t)ymd.year;
}
/* static */ SQInteger ScriptDate::GetMonth(ScriptDate::Date date)
@@ -58,7 +58,7 @@
if (day_of_month < 1 || day_of_month > 31) return DATE_INVALID;
if (year < 0 || year > MAX_YEAR) return DATE_INVALID;
return (ScriptDate::Date)::TimerGameCalendar::ConvertYMDToDate(year, month - 1, day_of_month);
return (ScriptDate::Date)(int32_t)::TimerGameCalendar::ConvertYMDToDate(year, month - 1, day_of_month);
}
/* static */ SQInteger ScriptDate::GetSystemTime()