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:
@@ -129,7 +129,7 @@ void CheckTrainsLengths()
|
||||
void CheckBreakdownFlags(Train *v)
|
||||
{
|
||||
assert(v->IsFrontEngine());
|
||||
/* clear the flags we're gonna check first, we'll set them again later (if applicable ) */
|
||||
/* clear the flags we're gonna check first, we'll set them again later (if applicable) */
|
||||
CLRBITS(v->flags, (1 << VRF_BREAKDOWN_BRAKING) | VRF_IS_BROKEN);
|
||||
|
||||
for (const Train *w = v; w != NULL; w = w->Next()) {
|
||||
@@ -492,10 +492,8 @@ void Train::UpdateAcceleration()
|
||||
|
||||
if (_settings_game.vehicle.improved_breakdowns) {
|
||||
if (_settings_game.vehicle.train_acceleration_model == AM_ORIGINAL) {
|
||||
this->breakdown_chance = max(128 * 3 / (this->tcache.cached_num_engines + 2), 5);
|
||||
this->breakdown_chance_factor = max(128 * 3 / (this->tcache.cached_num_engines + 2), 5);
|
||||
}
|
||||
} else {
|
||||
this->breakdown_chance = 128;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4055,7 +4053,6 @@ void Train::OnNewDay()
|
||||
if ((++this->day_counter & 7) == 0) DecreaseVehicleValue(this);
|
||||
|
||||
if (this->IsFrontEngine()) {
|
||||
|
||||
CheckIfTrainNeedsService(this);
|
||||
|
||||
CheckOrders(this);
|
||||
|
Reference in New Issue
Block a user