From b5861fd8f3fc51624c2df87ff305d3b7f59f3798 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sun, 5 Nov 2023 15:43:56 +0000 Subject: [PATCH] Fix: Using MIN_YEAR for a date is probably wrong, Use MIN_DATE instead. (#11444) Even with strong types ... --- src/table/roadtypes.h | 2 +- src/timer/timer_game_calendar.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/table/roadtypes.h b/src/table/roadtypes.h index f4148cf85f..7d5e321a77 100644 --- a/src/table/roadtypes.h +++ b/src/table/roadtypes.h @@ -82,7 +82,7 @@ static const RoadTypeInfo _original_roadtypes[] = { 0x01, /* introduction date */ - static_cast(CalendarTime::MIN_YEAR), + CalendarTime::MIN_DATE, /* roadtypes required for this to be introduced */ ROADTYPES_NONE, diff --git a/src/timer/timer_game_calendar.h b/src/timer/timer_game_calendar.h index a4ea3f27a3..e62f745615 100644 --- a/src/timer/timer_game_calendar.h +++ b/src/timer/timer_game_calendar.h @@ -178,6 +178,9 @@ public: /** The date of the first day of the original base year. */ static constexpr TimerGameCalendar::Date DAYS_TILL_ORIGINAL_BASE_YEAR = TimerGameCalendar::DateAtStartOfYear(ORIGINAL_BASE_YEAR); + /** The absolute minimum date. */ + static constexpr TimerGameCalendar::Date MIN_DATE = 0; + /** The date of the last day of the max year. */ static constexpr TimerGameCalendar::Date MAX_DATE = TimerGameCalendar::DateAtStartOfYear(CalendarTime::MAX_YEAR + 1) - 1;