From 8cf2b827a128b3e039a3c7e842bc2ff51733d77c Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 18 Mar 2021 13:59:05 +0000 Subject: [PATCH] Avoid pessimising braking speed when descending slope When calculating speed using variable braking force --- src/train_cmd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 4d165dfab8..3092670b83 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -796,7 +796,7 @@ static int GetRealisticBrakingSpeedForDistance(const TrainDecelerationStats &sta v_calc -= IntCbrt(-cb2); } int64 v_calc_sq = sqr(v_calc); - if (v_calc_sq < speed_sqr) { + if (v_calc_sq < speed_sqr && v_calc_sq > slope_speed_sqr) { return std::max((int)REALISTIC_BRAKING_MIN_SPEED, v_calc); } }