|
@@ -923,42 +923,43 @@ void CheckVehicleBreakdown(Vehicle *v)
|
|
|
v->breakdown_ctr = GB(r, 16, 6) + 0x3F;
|
|
|
v->breakdown_delay = GB(r, 24, 7) + 0x80;
|
|
|
v->breakdown_chance = 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
static void ShowVehicleGettingOld(Vehicle *v, StringID msg)
|
|
|
{
|
|
|
if (v->owner != _local_company) return;
|
|
|
|
|
|
/* Do not show getting-old message if autorenew is active (and it can replace the vehicle) */
|
|
|
if (GetCompany(v->owner)->engine_renew && GetEngine(v->engine_type)->company_avail != 0) return;
|
|
|
|
|
|
SetDParam(0, v->index);
|
|
|
AddNewsItem(msg, NS_ADVICE, v->index, 0);
|
|
|
}
|
|
|
|
|
|
void AgeVehicle(Vehicle *v)
|
|
|
{
|
|
|
if (v->age < 65535) v->age++;
|
|
|
|
|
|
int age = v->age - v->max_age;
|
|
|
if (age == DAYS_IN_LEAP_YEAR * 0 || age == DAYS_IN_LEAP_YEAR * 1 ||
|
|
|
age == DAYS_IN_LEAP_YEAR * 2 || age == DAYS_IN_LEAP_YEAR * 3 || age == DAYS_IN_LEAP_YEAR * 4) {
|
|
|
v->reliability_spd_dec <<= 1;
|
|
|
}
|
|
|
|
|
|
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
|
|
|
|
|
|
/* Don't warn about non-primary or not ours vehicles */
|
|
|
if (v->Previous() != NULL || v->owner != _local_company) return;
|
|
|
|
|
|
/* Don't warn if a renew is active */
|
|
|
if (GetCompany(v->owner)->engine_renew && GetEngine(v->engine_type)->company_avail != 0) return;
|
|
|
|
|
|
StringID str;
|
|
|
if (age == -DAYS_IN_LEAP_YEAR) {
|
|
|
ShowVehicleGettingOld(v, STR_01A0_IS_GETTING_OLD);
|
|
|
str = STR_01A0_IS_GETTING_OLD;
|
|
|
} else if (age == 0) {
|
|
|
ShowVehicleGettingOld(v, STR_01A1_IS_GETTING_VERY_OLD);
|
|
|
str = STR_01A1_IS_GETTING_VERY_OLD;
|
|
|
} else if (age > 0 && (age % DAYS_IN_LEAP_YEAR) == 0) {
|
|
|
ShowVehicleGettingOld(v, STR_01A2_IS_GETTING_VERY_OLD_AND);
|
|
|
str = STR_01A2_IS_GETTING_VERY_OLD_AND;
|
|
|
} else {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
SetDParam(0, v->index);
|
|
|
AddNewsItem(str, NS_ADVICE, v->index, 0);
|
|
|
}
|
|
|
|
|
|
/** Start/Stop a vehicle
|
|
|
* @param tile unused
|
|
|
* @param flags type of operation
|
|
|
* @param p1 vehicle to start/stop
|