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

@@ -424,10 +424,10 @@ struct CompanyFinancesWindow : Window {
case WID_CF_EXPS_PRICE2:
case WID_CF_EXPS_PRICE3: {
const Company *c = Company::Get((CompanyID)this->window_number);
YearDelta age = std::min<YearDelta>(CalTime::CurYear() - c->inaugurated_year, 2);
YearDelta age = std::min<YearDelta>(c->age_years, 2);
int wid_offset = widget - WID_CF_EXPS_PRICE1;
if (wid_offset <= age.base()) {
DrawYearColumn(r, CalTime::CurYear().base() - (age.base() - wid_offset), c->yearly_expenses[age.base() - wid_offset]);
DrawYearColumn(r, EconTime::YearToDisplay(EconTime::CurYear().base() - (age.base() - wid_offset)), c->yearly_expenses[age.base() - wid_offset]);
}
break;
}
@@ -2595,7 +2595,7 @@ struct CompanyWindow : Window
break;
case WID_C_DESC_INAUGURATION:
SetDParam(0, Company::Get((CompanyID)this->window_number)->inaugurated_year);
SetDParam(0, Company::Get((CompanyID)this->window_number)->InauguratedDisplayYear());
break;
case WID_C_DESC_COMPANY_VALUE: