Improved breakdowns: Various changes and fixes.
* Revert breakdown_chance to (mostly) its original behaviour. * Create a new breakdown_chance_factor to hold breakdown_chance from improved breakdowns logic. * Revert airport crash probabilities back to original behaviour, with modified behaviour only during emergency landings. * Low power breakdowns now only reduce the power of the engine which has broken down. * Low power breakdowns no longer reduce speed directly. * Add callback function to run whenever improved breakdowns setting is changed. Reset breakdown_chance_factor where required. * More whitespace/formatting...
This commit is contained in:
@@ -2835,14 +2835,15 @@ bool AfterLoadGame()
|
||||
v->reliability = min(v->First()->reliability, e->reliability);
|
||||
}
|
||||
}
|
||||
/* FALL THROUGH */
|
||||
case VEH_ROAD:
|
||||
v->breakdown_chance = 128;
|
||||
v->breakdown_chance_factor = 128;
|
||||
break;
|
||||
case VEH_SHIP:
|
||||
v->breakdown_chance = 64;
|
||||
v->breakdown_chance_factor = 64;
|
||||
break;
|
||||
case VEH_AIRCRAFT:
|
||||
v->breakdown_chance = Clamp(64 + (AircraftVehInfo(v->engine_type)->max_speed >> 3), 0, 255);
|
||||
v->breakdown_chance_factor = Clamp(64 + (AircraftVehInfo(v->engine_type)->max_speed >> 3), 0, 255);
|
||||
v->breakdown_severity = 40;
|
||||
break;
|
||||
default: break;
|
||||
|
@@ -671,6 +671,7 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
|
||||
SLE_VAR(Vehicle, breakdown_delay, SLE_UINT8),
|
||||
SLE_VAR(Vehicle, breakdowns_since_last_service, SLE_UINT8),
|
||||
SLE_VAR(Vehicle, breakdown_chance, SLE_UINT8),
|
||||
SLE_CONDVAR(Vehicle, breakdown_chance_factor, SLE_UINT8, SL_IB, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, breakdown_type, SLE_UINT8, SL_IB, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, breakdown_severity, SLE_UINT8, SL_IB, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, build_year, SLE_FILE_U8 | SLE_VAR_I32, 0, 30),
|
||||
|
Reference in New Issue
Block a user