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:
@@ -1020,7 +1020,7 @@ static bool RoadVehAccelerationModelChanged(int32 p1)
|
||||
RoadVehicle *rv;
|
||||
FOR_ALL_ROADVEHICLES(rv) {
|
||||
if (rv->IsFrontEngine()) {
|
||||
rv->breakdown_chance = 128;
|
||||
rv->breakdown_chance_factor = 128;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1319,6 +1319,32 @@ static bool MaxVehiclesChanged(int32 p1)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ImprovedBreakdownsSettingChanged(int32 p1)
|
||||
{
|
||||
if (!_settings_game.vehicle.improved_breakdowns) return true;
|
||||
|
||||
Vehicle *v;
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
switch(v->type) {
|
||||
case VEH_TRAIN:
|
||||
if (v->IsFrontEngine()) {
|
||||
v->breakdown_chance_factor = 128;
|
||||
Train::From(v)->UpdateAcceleration();
|
||||
}
|
||||
break;
|
||||
|
||||
case VEH_ROAD:
|
||||
if (v->IsFrontEngine()) {
|
||||
v->breakdown_chance_factor = 128;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
|
Reference in New Issue
Block a user