mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Use SQInteger for generic numbers in script_date
parent
424ae74504
commit
2f40bf8097
|
@ -25,7 +25,7 @@
|
||||||
return (ScriptDate::Date)_date;
|
return (ScriptDate::Date)_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ int32 ScriptDate::GetYear(ScriptDate::Date date)
|
/* static */ SQInteger ScriptDate::GetYear(ScriptDate::Date date)
|
||||||
{
|
{
|
||||||
if (date < 0) return DATE_INVALID;
|
if (date < 0) return DATE_INVALID;
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
return ymd.year;
|
return ymd.year;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ int32 ScriptDate::GetMonth(ScriptDate::Date date)
|
/* static */ SQInteger ScriptDate::GetMonth(ScriptDate::Date date)
|
||||||
{
|
{
|
||||||
if (date < 0) return DATE_INVALID;
|
if (date < 0) return DATE_INVALID;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
return ymd.month + 1;
|
return ymd.month + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ int32 ScriptDate::GetDayOfMonth(ScriptDate::Date date)
|
/* static */ SQInteger ScriptDate::GetDayOfMonth(ScriptDate::Date date)
|
||||||
{
|
{
|
||||||
if (date < 0) return DATE_INVALID;
|
if (date < 0) return DATE_INVALID;
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
return ymd.day;
|
return ymd.day;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ ScriptDate::Date ScriptDate::GetDate(int32 year, int32 month, int32 day_of_month)
|
/* static */ ScriptDate::Date ScriptDate::GetDate(SQInteger year, SQInteger month, SQInteger day_of_month)
|
||||||
{
|
{
|
||||||
if (month < 1 || month > 12) return DATE_INVALID;
|
if (month < 1 || month > 12) return DATE_INVALID;
|
||||||
if (day_of_month < 1 || day_of_month > 31) return DATE_INVALID;
|
if (day_of_month < 1 || day_of_month > 31) return DATE_INVALID;
|
||||||
|
@ -61,7 +61,7 @@
|
||||||
return (ScriptDate::Date)::ConvertYMDToDate(year, month - 1, day_of_month);
|
return (ScriptDate::Date)::ConvertYMDToDate(year, month - 1, day_of_month);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ int32 ScriptDate::GetSystemTime()
|
/* static */ SQInteger ScriptDate::GetSystemTime()
|
||||||
{
|
{
|
||||||
time_t t;
|
time_t t;
|
||||||
time(&t);
|
time(&t);
|
||||||
|
|
|
@ -55,21 +55,21 @@ public:
|
||||||
* @param date The date to get the year of.
|
* @param date The date to get the year of.
|
||||||
* @return The year.
|
* @return The year.
|
||||||
*/
|
*/
|
||||||
static int32 GetYear(Date date);
|
static SQInteger GetYear(Date date);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the month of the given date.
|
* Get the month of the given date.
|
||||||
* @param date The date to get the month of.
|
* @param date The date to get the month of.
|
||||||
* @return The month.
|
* @return The month.
|
||||||
*/
|
*/
|
||||||
static int32 GetMonth(Date date);
|
static SQInteger GetMonth(Date date);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the day (of the month) of the given date.
|
* Get the day (of the month) of the given date.
|
||||||
* @param date The date to get the day of.
|
* @param date The date to get the day of.
|
||||||
* @return The day.
|
* @return The day.
|
||||||
*/
|
*/
|
||||||
static int32 GetDayOfMonth(Date date);
|
static SQInteger GetDayOfMonth(Date date);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the date given a year, month and day of month.
|
* Get the date given a year, month and day of month.
|
||||||
|
@ -78,7 +78,7 @@ public:
|
||||||
* @param day_of_month The day of month of the to-be determined date.
|
* @param day_of_month The day of month of the to-be determined date.
|
||||||
* @return The date.
|
* @return The date.
|
||||||
*/
|
*/
|
||||||
static Date GetDate(int32 year, int32 month, int32 day_of_month);
|
static Date GetDate(SQInteger year, SQInteger month, SQInteger day_of_month);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the time of the host system.
|
* Get the time of the host system.
|
||||||
|
@ -86,7 +86,7 @@ public:
|
||||||
* @api -ai
|
* @api -ai
|
||||||
* @note This uses the clock of the host system, which can skew or be set back. Use with caution.
|
* @note This uses the clock of the host system, which can skew or be set back. Use with caution.
|
||||||
*/
|
*/
|
||||||
static int32 GetSystemTime();
|
static SQInteger GetSystemTime();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SCRIPT_DATE_HPP */
|
#endif /* SCRIPT_DATE_HPP */
|
||||||
|
|
Loading…
Reference in New Issue