Adjust handling of year display in wallclock mode and company inauguration years

See: #657
This commit is contained in:
Jonathan G Rennison
2024-02-24 23:35:20 +00:00
parent 1bfcbf823c
commit 090656bd7f
16 changed files with 75 additions and 15 deletions

View File

@@ -240,9 +240,12 @@ struct EconTime : public DateDetail::BaseTime<struct EconTimeTag> {
/* Use a detail struct/namespace to more easily control writes */
struct Detail {
static State now;
static YearDelta years_elapsed;
static YearDelta period_display_offset;
static void SetDate(Date date, DateFract fract);
static State NewState(Year year);
static int32_t WallClockYearToDisplay(Year year);
/**
* Calculate the date of the first day of a given year.
@@ -289,6 +292,12 @@ struct EconTime : public DateDetail::BaseTime<struct EconTimeTag> {
if (UsingWallclockUnits()) return Detail::DateAtStartOfWallclockModeYear(year);
return ParentBaseTime::Detail::DateAtStartOfCalendarYear(year);
}
static inline int32_t YearToDisplay(Year year)
{
if (UsingWallclockUnits()) return Detail::WallClockYearToDisplay(year);
return year.base();
}
};
namespace DateDetail {