|
@@ -1366,22 +1366,22 @@ bool Vehicle::HandleBreakdown()
|
|
|
/**
|
|
|
* Update age of a vehicle.
|
|
|
* @param v Vehicle to update.
|
|
|
*/
|
|
|
void AgeVehicle(Vehicle *v)
|
|
|
{
|
|
|
if (v->age < MAX_DATE) {
|
|
|
if (v->age < CalendarTime::MAX_DATE) {
|
|
|
v->age++;
|
|
|
if (v->IsPrimaryVehicle() && v->age == VEHICLE_PROFIT_MIN_AGE + 1) GroupStatistics::VehicleReachedMinAge(v);
|
|
|
}
|
|
|
|
|
|
if (!v->IsPrimaryVehicle() && (v->type != VEH_TRAIN || !Train::From(v)->IsEngine())) return;
|
|
|
|
|
|
auto age = v->age - v->max_age;
|
|
|
for (int32_t i = 0; i <= 4; i++) {
|
|
|
if (age == DateAtStartOfYear(i)) {
|
|
|
if (age == TimerGameCalendar::DateAtStartOfYear(i)) {
|
|
|
v->reliability_spd_dec <<= 1;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
|
|
@@ -1393,17 +1393,17 @@ void AgeVehicle(Vehicle *v)
|
|
|
/* Don't warn if a renew is active */
|
|
|
if (c->settings.engine_renew && v->GetEngine()->company_avail != 0) return;
|
|
|
/* Don't warn if a replacement is active */
|
|
|
if (EngineHasReplacementForCompany(c, v->engine_type, v->group_id)) return;
|
|
|
|
|
|
StringID str;
|
|
|
if (age == DateAtStartOfYear(-1)) {
|
|
|
if (age == TimerGameCalendar::DateAtStartOfYear(-1)) {
|
|
|
str = STR_NEWS_VEHICLE_IS_GETTING_OLD;
|
|
|
} else if (age == DateAtStartOfYear(0)) {
|
|
|
} else if (age == TimerGameCalendar::DateAtStartOfYear(0)) {
|
|
|
str = STR_NEWS_VEHICLE_IS_GETTING_VERY_OLD;
|
|
|
} else if (age > DateAtStartOfYear(0) && (static_cast<int32_t>(age) % DAYS_IN_LEAP_YEAR) == 0) {
|
|
|
} else if (age > TimerGameCalendar::DateAtStartOfYear(0) && (static_cast<int32_t>(age) % CalendarTime::DAYS_IN_LEAP_YEAR) == 0) {
|
|
|
str = STR_NEWS_VEHICLE_IS_GETTING_VERY_OLD_AND;
|
|
|
} else {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
SetDParam(0, v->index);
|