Strong typedef: Use strong typedefs for date, date tick, minutes types
Add delta types Adjust/add type conversion functions Add various utility methods on types Remove the various minute macros Fix some minute conversion inconsistencies
This commit is contained in:
@@ -7403,7 +7403,7 @@ bool GetGlobalVariable(byte param, uint32 *value, const GRFFile *grffile)
|
||||
|
||||
switch (param) {
|
||||
case 0x00: // current date
|
||||
*value = std::max(_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0);
|
||||
*value = std::max<DateDelta>(_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0).base();
|
||||
return true;
|
||||
|
||||
case 0x01: // current year
|
||||
@@ -7412,7 +7412,7 @@ bool GetGlobalVariable(byte param, uint32 *value, const GRFFile *grffile)
|
||||
|
||||
case 0x02: { // detailed date information: month of year (bit 0-7), day of month (bit 8-12), leap year (bit 15), day of year (bit 16-24)
|
||||
Date start_of_year = ConvertYMDToDate(_cur_date_ymd.year, 0, 1);
|
||||
*value = _cur_date_ymd.month | (_cur_date_ymd.day - 1) << 8 | (IsLeapYear(_cur_date_ymd.year) ? 1 << 15 : 0) | (_date - start_of_year) << 16;
|
||||
*value = _cur_date_ymd.month | (_cur_date_ymd.day - 1) << 8 | (IsLeapYear(_cur_date_ymd.year) ? 1 << 15 : 0) | (_date - start_of_year).base() << 16;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -7518,7 +7518,7 @@ bool GetGlobalVariable(byte param, uint32 *value, const GRFFile *grffile)
|
||||
return true;
|
||||
|
||||
case 0x23: // long format date
|
||||
*value = _date;
|
||||
*value = _date.base();
|
||||
return true;
|
||||
|
||||
case 0x24: // long format year
|
||||
|
Reference in New Issue
Block a user