Codechange: use TimerGameCalendar::Year and friends when working with years (#11188)
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user