17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-12 01:48:14 +01:00

AI braking: move the uphill power-off check into its own function

The condition added for holding the speed uphill near a stop pushed the
cognitive complexity of control_tractive_force() to 26, over the 25
SonarCloud allows. It now lives in is_too_fast_uphill(); the behaviour
is unchanged.
This commit is contained in:
pwarszawski
2026-11-02 16:43:16 +01:00
parent 1f3cf4fe56
commit 18bc7e06bf
2 changed files with 9 additions and 5 deletions

View File

@@ -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