Codechange: use TimerGameCalendar::Year and friends when working with years (#11188)

This commit is contained in:
Patric Stout
2023-08-12 16:02:31 +02:00
committed by GitHub
parent 01f55eb734
commit b7acf9e50e
8 changed files with 13 additions and 13 deletions

View File

@@ -1376,7 +1376,7 @@ void AgeVehicle(Vehicle *v)
if (!v->IsPrimaryVehicle() && (v->type != VEH_TRAIN || !Train::From(v)->IsEngine())) return;
int age = v->age - v->max_age;
auto age = v->age - v->max_age;
for (int32_t i = 0; i <= 4; i++) {
if (age == DateAtStartOfYear(i)) {
v->reliability_spd_dec <<= 1;
@@ -1396,11 +1396,11 @@ void AgeVehicle(Vehicle *v)
if (EngineHasReplacementForCompany(c, v->engine_type, v->group_id)) return;
StringID str;
if (age == -DAYS_IN_LEAP_YEAR) {
if (age == DateAtStartOfYear(-1)) {
str = STR_NEWS_VEHICLE_IS_GETTING_OLD;
} else if (age == 0) {
} else if (age == DateAtStartOfYear(0)) {
str = STR_NEWS_VEHICLE_IS_GETTING_VERY_OLD;
} else if (age > 0 && (age % DAYS_IN_LEAP_YEAR) == 0) {
} else if (age > DateAtStartOfYear(0) && (age % DAYS_IN_LEAP_YEAR) == 0) {
str = STR_NEWS_VEHICLE_IS_GETTING_VERY_OLD_AND;
} else {
return;