Merge branch 'improved_breakdowns-sx' into jgrpp

This commit is contained in:
Jonathan G Rennison
2015-09-27 23:18:40 +01:00
3 changed files with 15 additions and 6 deletions

View File

@@ -1022,6 +1022,14 @@ static bool RoadVehAccelerationModelChanged(int32 p1)
}
}
}
if (_settings_game.vehicle.roadveh_acceleration_model == AM_ORIGINAL || !_settings_game.vehicle.improved_breakdowns) {
RoadVehicle *rv;
FOR_ALL_ROADVEHICLES(rv) {
if (rv->IsFrontEngine()) {
rv->breakdown_chance = 128;
}
}
}
/* These windows show acceleration values only when realistic acceleration is on. They must be redrawn after a setting change. */
SetWindowClassesDirty(WC_ENGINE_PREVIEW);

View File

@@ -485,8 +485,13 @@ void Train::UpdateAcceleration()
assert(weight != 0);
this->acceleration = Clamp(power / weight * 4, 1, 255);
/* for non-realistic acceleration, breakdown chance is 128, corrected by the multiengine factor of 3/(n+2) */
this->breakdown_chance = min(128 * 3 / (this->tcache.cached_num_engines + 2), 5);
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);
}
} else {
this->breakdown_chance = 128;
}
}
/**

View File

@@ -118,8 +118,6 @@ void VehicleServiceInDepot(Vehicle *v)
v->reliability = e->reliability;
v->breakdown_ctr = 0;
v->vehstatus &= ~VS_AIRCRAFT_BROKEN;
/* Prevent vehicles from breaking down directly after exiting the depot. */
v->breakdown_chance /= 4;
SetWindowDirty(WC_VEHICLE_DETAILS, v->index); // ensure that last service date and reliability are updated
do {
@@ -157,8 +155,6 @@ void VehicleServiceInDepot(Vehicle *v)
v->breakdowns_since_last_service = 0;
v->reliability = v->GetEngine()->reliability;
/* Prevent vehicles from breaking down directly after exiting the depot. */
v->breakdown_chance /= 4;
v = v->Next();
} while (v != NULL && v->HasEngineType());
}