Add: Setting to uniformly slow the acceleration and braking of realistic trains

This does not affect the maximum speed.
This commit is contained in:
Alistair Lynn
2024-05-25 18:24:25 +00:00
committed by Jonathan G Rennison
parent 0351734729
commit 7ef8706ed2
6 changed files with 26 additions and 2 deletions

View File

@@ -309,7 +309,13 @@ GroundVehicleAcceleration GroundVehicle<T, Type>::GetAcceleration()
ShowTrainTooHeavyAdviceMessage(this);
}
if (Train::From(this)->UsingRealisticBraking() && _settings_game.vehicle.limit_train_acceleration) {
bool using_realistic_braking = Train::From(this)->UsingRealisticBraking();
if (using_realistic_braking) {
accel = DivTowardsPositiveInf(accel * _settings_game.vehicle.train_acc_braking_percent, 100);
}
if (using_realistic_braking && _settings_game.vehicle.limit_train_acceleration) {
accel = std::min(accel, 250);
}
}