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:
Jonathan G Rennison
2023-12-19 01:03:18 +00:00
parent 1e7b56e13a
commit 03e0ec8276
80 changed files with 538 additions and 431 deletions

View File

@@ -135,6 +135,22 @@ struct TimeSettings {
bool time_in_minutes; ///< whether to use the hh:mm conversion when printing dates
uint16 ticks_per_minute; ///< how many ticks per minute
uint16 clock_offset; ///< clock offset in minutes
TickMinutes ToTickMinutes(DateTicksScaled ticks) const
{
return (ticks.base() / this->ticks_per_minute) + this->clock_offset;
}
TickMinutes NowInTickMinutes() const
{
extern DateTicksScaled _scaled_date_ticks;
return this->ToTickMinutes(_scaled_date_ticks);
}
DateTicksScaled FromTickMinutes(TickMinutes minutes) const
{
return (minutes.base() - this->clock_offset) * this->ticks_per_minute;
}
};
/** Settings related to the GUI and other stuff that is not saved in the savegame. */