From 2531418d26f44c07a4b11e0362d3b73b3cb50941 Mon Sep 17 00:00:00 2001 From: maj00r Date: Tue, 15 Sep 2026 00:03:42 +0200 Subject: [PATCH] Let a command cell reach a shut down driver A dormant driver scans, but bailed out before anything could act on the table. Signals stay out of it - only cm_Command is dispatched, so a memory cell put in front of a parked consist can hand it Prepare_engine. --- vehicle/Driver.cpp | 12 ++++++++++++ vehicle/Driver.h | 1 + 2 files changed, 13 insertions(+) diff --git a/vehicle/Driver.cpp b/vehicle/Driver.cpp index b68ac224..5388a739 100644 --- a/vehicle/Driver.cpp +++ b/vehicle/Driver.cpp @@ -7524,6 +7524,7 @@ TController::pick_optimal_speed( double const Range ) { // if we're idling bail out early if( false == is_active() ) { + check_cell_ahead(); VelDesired = 0.0; VelNext = 0.0; AccDesired = std::min( AccDesired, EU07_AI_NOACCELERATION ); @@ -8550,6 +8551,17 @@ TController::check_route_ahead( double const Range ) { } } +void +TController::check_cell_ahead() { + // shut down, so no signal is acted upon; a command cell is the only way to reach us + if( false == AIControllFlag ) { return; } + if( ( OrderCurrentGet() & ~( Shunt | Loose_shunt | Obey_train | Bank ) ) != 0 ) { return; } + if( mvOccupied->Vel >= 0.1 ) { return; } + if( TableUpdate( VelDesired, ActualProximityDist, VelNext, AccDesired ) != TCommandType::cm_Command ) { return; } + if( eSignNext == nullptr ) { return; } + eSignNext->send_command( *this ); +} + void TController::check_route_behind( double const Range ) { diff --git a/vehicle/Driver.h b/vehicle/Driver.h index 4943611e..679d5f50 100644 --- a/vehicle/Driver.h +++ b/vehicle/Driver.h @@ -387,6 +387,7 @@ private: void control_braking_force(); void apply_independent_brake_only(); void check_route_ahead( double const Range ); + void check_cell_ahead(); // shut down driver: only a command cell can reach it // false when the permission at the nearest signal was given to another consist bool SignalPermissionIsOurs( bool const Signalgivesgo ) const; bool OtherConsistAtSignal() const; // another consist in front of the signal = the addressee of the permission