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

@@ -1428,7 +1428,7 @@ class NIHSignals : public NIHelper {
if (it.second.IsOutOfDate()) {
b += seprintf(b, lastof(buffer), ", expired");
} else {
b += seprintf(b, lastof(buffer), ", expires in %u ticks", (uint)(it.second.time_stamp - _scaled_date_ticks));
b += seprintf(b, lastof(buffer), ", expires in %u ticks", (uint)(it.second.time_stamp - _scaled_date_ticks).base());
}
output.print(buffer);
}
@@ -1532,7 +1532,7 @@ class NIHObject : public NIHelper {
ConvertDateToYMD(spec->introduction_date, &ymd);
char *b = buffer + seprintf(buffer, lastof(buffer), " intro: %4i-%02i-%02i",
ymd.year, ymd.month + 1, ymd.day);
if (spec->end_of_life_date < MAX_DAY) {
if (spec->end_of_life_date < MAX_DATE) {
ConvertDateToYMD(spec->end_of_life_date, &ymd);
seprintf(b, lastof(buffer), ", end of life: %4i-%02i-%02i",
ymd.year, ymd.month + 1, ymd.day);

View File

@@ -121,7 +121,7 @@ static const DrawTileSprites _object_hq[] = {
#undef TILE_SPRITE_LINE
#define M(name, size, build_cost_multiplier, clear_cost_multiplier, height, climate, gen_amount, flags) { GRFFilePropsBase<2>(), {0, 0, 0, 0}, INVALID_OBJECT_CLASS, name, climate, size, build_cost_multiplier, clear_cost_multiplier, 0, MAX_DAY + 1, flags, OBJECT_CTRL_FLAG_NONE, {0, 0, 0, 0}, 0, height, 1, gen_amount, OVMT_DEFAULT, 0 }
#define M(name, size, build_cost_multiplier, clear_cost_multiplier, height, climate, gen_amount, flags) { GRFFilePropsBase<2>(), {0, 0, 0, 0}, INVALID_OBJECT_CLASS, name, climate, size, build_cost_multiplier, clear_cost_multiplier, 0, MAX_DATE + 1, flags, OBJECT_CTRL_FLAG_NONE, {0, 0, 0, 0}, 0, height, 1, gen_amount, OVMT_DEFAULT, 0 }
/* Climates
* T = Temperate