Split date types into calendar and economy dates

See: 735abfe1
This commit is contained in:
Jonathan G Rennison
2024-02-13 21:34:09 +00:00
parent fad5ee56e7
commit 7ce06e22b8
141 changed files with 1325 additions and 1082 deletions

View File

@@ -420,10 +420,10 @@ struct CompanyFinancesWindow : Window {
case WID_CF_EXPS_PRICE2:
case WID_CF_EXPS_PRICE3: {
const Company *c = Company::Get((CompanyID)this->window_number);
int age = std::min(_cur_year - c->inaugurated_year, 2);
YearDelta age = std::min<YearDelta>(CalTime::CurYear() - c->inaugurated_year, 2);
int wid_offset = widget - WID_CF_EXPS_PRICE1;
if (wid_offset <= age) {
DrawYearColumn(r, _cur_year - (age - wid_offset), c->yearly_expenses[age - wid_offset]);
if (wid_offset <= age.base()) {
DrawYearColumn(r, CalTime::CurYear().base() - (age.base() - wid_offset), c->yearly_expenses[age.base() - wid_offset]);
}
break;
}
@@ -1859,7 +1859,7 @@ struct CompanyInfrastructureWindow : Window
}
/* Get the date introduced railtypes as well. */
this->railtypes = AddDateIntroducedRailTypes(this->railtypes, MAX_DATE);
this->railtypes = AddDateIntroducedRailTypes(this->railtypes, CalTime::MAX_DATE);
/* Find the used roadtypes. */
for (const Engine *e : Engine::IterateType(VEH_ROAD)) {
@@ -1869,7 +1869,7 @@ struct CompanyInfrastructureWindow : Window
}
/* Get the date introduced roadtypes as well. */
this->roadtypes = AddDateIntroducedRoadTypes(this->roadtypes, MAX_DATE);
this->roadtypes = AddDateIntroducedRoadTypes(this->roadtypes, CalTime::MAX_DATE);
this->roadtypes &= ~_roadtypes_hidden_mask;
}