diff --git a/vehicle/Driver.cpp b/vehicle/Driver.cpp index 6d6c1532e..2311ffacf 100644 --- a/vehicle/Driver.cpp +++ b/vehicle/Driver.cpp @@ -8110,11 +8110,7 @@ void TController::control_tractive_force() { cue_action( driver_hint::mastercontrollersetzerospeed ); } else if( velocity > VelDesired + SpeedCtrlMargin - || ( fAccGravity < -0.01 ? - AccDesired < 0.0 - // holding the speed uphill on the way to a stop asks for no speeding up - || ( VelNext == 0.0 && ActualProximityDist <= fMaxProximityDist && AbsAccS > AccDesired + 0.05 ) : - AbsAccS > AccDesired + 10.05 ) + || ( fAccGravity < -0.01 ? is_too_fast_uphill() : AbsAccS > AccDesired + 10.05 ) || IsAnyCouplerStretched ) { // jak za bardzo przyspiesza albo prędkość przekroczona // dodany wyjatek na "pelna w przod" @@ -8126,6 +8122,13 @@ void TController::control_tractive_force() { SpeedSet(); // ciągla regulacja prędkości } +bool TController::is_too_fast_uphill() const { + + if( AccDesired < 0.0 ) { return true; } + // holding the speed uphill on the way to a stop asks for no speeding up + return ( VelNext == 0.0 && ActualProximityDist <= fMaxProximityDist && AbsAccS > AccDesired + 0.05 ); +} + void TController::increase_tractive_force() { if( fActionTime < 0.0 ) { return; } // gdy jest nakaz poczekać z jazdą, to nie ruszać diff --git a/vehicle/Driver.h b/vehicle/Driver.h index af97b4a1e..11a01517f 100644 --- a/vehicle/Driver.h +++ b/vehicle/Driver.h @@ -358,6 +358,7 @@ private: void control_motor_connectors(); void control_tractive_force(); void increase_tractive_force(); + bool is_too_fast_uphill() const; void control_braking_force(); // how far short of a stop the AI aims: in train running the middle of the 8-15 m window before a signal, // otherwise (a W4 stop point, shunting, coupling) half the minimum proximity distance, as before