mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
security system magnet interaction enhancement, vehicle startup check tweak
This commit is contained in:
40
Driver.cpp
40
Driver.cpp
@@ -271,6 +271,9 @@ void TSpeedPos::CommandCheck()
|
||||
case TCommandType::cm_EmergencyBrake:
|
||||
fVelNext = -1;
|
||||
break;
|
||||
case TCommandType::cm_SecuritySystemMagnet:
|
||||
fVelNext = -1;
|
||||
break;
|
||||
default:
|
||||
// inna komenda w evencie skanowanym powoduje zatrzymanie i wysłanie tej komendy
|
||||
// nie manewrowa, nie przystanek, nie zatrzymać na SBL
|
||||
@@ -880,6 +883,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
eSignNext = nullptr;
|
||||
IsAtPassengerStop = false;
|
||||
IsScheduledPassengerStopVisible = false;
|
||||
mvOccupied->SecuritySystem.SHPLock = false;
|
||||
// te flagi są ustawiane tutaj, w razie potrzeby
|
||||
iDrivigFlags &= ~(moveTrackEnd | moveSwitchFound | moveSemaphorFound | /*moveSpeedLimitFound*/ moveStopPointFound );
|
||||
|
||||
@@ -1404,9 +1408,29 @@ TController::TableUpdateEvent( double &Velocity, TCommandType &Command, TSpeedPo
|
||||
SemNextStopIndex = -1; // jeśli minęliśmy semafor od ograniczenia to go kasujemy ze zmiennej sprawdzającej dla skanowania w przód
|
||||
}
|
||||
switch( Point.evEvent->input_command() ) {
|
||||
// TBD, TODO: expand emergency_brake handling to a more generic security system signal
|
||||
case TCommandType::cm_EmergencyBrake: {
|
||||
pVehicle->RadioStop();
|
||||
Point.Clear(); // signal received, deactivate
|
||||
return true;
|
||||
}
|
||||
case TCommandType::cm_SecuritySystemMagnet: {
|
||||
// NOTE: magnet induction calculation presumes the driver is located in the front vehicle
|
||||
// TBD, TODO: take into account actual position of controlled/occupied vehicle in the consist, whichever comes first
|
||||
auto const magnetlocation { pVehicles[ end::front ]->MoverParameters->SecuritySystem.MagnetLocation };
|
||||
if( Point.fDist < -( magnetlocation ) ) {
|
||||
mvOccupied->SecuritySystem.SHPLock |= ( !AIControllFlag ); // don't make life difficult for the ai, but a human driver is a fair game
|
||||
PutCommand(
|
||||
Point.evEvent->input_text(),
|
||||
Point.evEvent->input_value( 1 ),
|
||||
Point.evEvent->input_value( 2 ),
|
||||
nullptr );
|
||||
}
|
||||
if( Point.fDist < -( magnetlocation + 0.5 ) ) {
|
||||
Point.Clear(); // magnet passed, deactivate
|
||||
mvOccupied->SecuritySystem.SHPLock = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
@@ -1415,6 +1439,19 @@ TController::TableUpdateEvent( double &Velocity, TCommandType &Command, TSpeedPo
|
||||
}
|
||||
// check signals ahead
|
||||
if( Point.fDist > 0.0 ) {
|
||||
// bail out early for signals which activate when passed
|
||||
// TBD: make it an event method?
|
||||
switch( Point.evEvent->input_command() ) {
|
||||
case TCommandType::cm_EmergencyBrake: {
|
||||
return true;
|
||||
}
|
||||
case TCommandType::cm_SecuritySystemMagnet: {
|
||||
return true;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( Point.IsProperSemaphor( OrderCurrentGet() ) ) {
|
||||
// special rule for cars: ignore stop signals at distance too short to come to a stop
|
||||
@@ -2793,7 +2830,8 @@ bool TController::PrepareEngine()
|
||||
&& ( true == IsAnyConverterEnabled )
|
||||
&& ( true == IsAnyCompressorEnabled )
|
||||
&& ( ( mvControlling->ScndPipePress > 4.5 ) || ( mvControlling->VeselVolume == 0.0 ) )
|
||||
&& ( ( mvOccupied->fBrakeCtrlPos == mvOccupied->Handle->GetPos( bh_RP ) || ( mvOccupied->BrakeHandle == TBrakeHandle::NoHandle ) ) );
|
||||
&& ( ( static_cast<int>( mvOccupied->fBrakeCtrlPos ) == static_cast<int>( mvOccupied->Handle->GetPos( bh_RP ) ) )
|
||||
|| ( mvOccupied->BrakeHandle == TBrakeHandle::NoHandle ) );
|
||||
}
|
||||
|
||||
if( true == isready ) {
|
||||
|
||||
Reference in New Issue
Block a user