16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-23 15:39:19 +02:00

configurable releaser lock, minor bug fixes

This commit is contained in:
tmj-fstate
2020-09-03 13:24:06 +02:00
parent c4ef056102
commit 5247e6c224
5 changed files with 33 additions and 13 deletions

View File

@@ -4871,14 +4871,21 @@ TController::UpdateSituation(double dt) {
IsAnyCouplerStretched = IsAnyCouplerStretched =
IsAnyCouplerStretched IsAnyCouplerStretched
|| ( vehicle->Couplers[ end::front ].stretch_duration > 0.0 ) || ( vehicle->Couplers[ end::front ].stretch_duration > 0.0 )
|| ( vehicle->Couplers[ end::rear ].stretch_duration > 0.0 ); || ( vehicle->Couplers[ end::rear ].stretch_duration > 0.0 );
// check door state // check door state
auto const switchsides { p->DirectionGet() != iDirection }; {
IsAnyDoorOpen[ side::right ] |= ( false == vehicle->Doors.instances[ ( switchsides ? side::left : side::right ) ].is_closed ); auto const switchsides { p->DirectionGet() != iDirection };
IsAnyDoorOpen[ side::left ] |= ( false == vehicle->Doors.instances[ ( switchsides ? side::right : side::left ) ].is_closed ); auto const &rightdoor { vehicle->Doors.instances[ ( switchsides ? side::left : side::right ) ] };
IsAnyDoorPermitActive[ side::right ] |= ( vehicle->Doors.permit_needed && vehicle->Doors.instances[ ( switchsides ? side::left : side::right ) ].open_permit ); auto const &leftdoor { vehicle->Doors.instances[ ( switchsides ? side::right : side::left ) ] };
IsAnyDoorPermitActive[ side::left ] |= ( vehicle->Doors.permit_needed && vehicle->Doors.instances[ ( switchsides ? side::right : side::left ) ].open_permit ); if( vehicle->Doors.close_control != control_t::autonomous ) {
IsAnyDoorOpen[ side::right ] |= ( false == rightdoor.is_closed );
IsAnyDoorOpen[ side::left ] |= ( false == leftdoor.is_closed );
}
if( vehicle->Doors.permit_needed ) {
IsAnyDoorPermitActive[ side::right ] |= rightdoor.open_permit;
IsAnyDoorPermitActive[ side::left ] |= leftdoor.open_permit;
}
}
// measure lighting level // measure lighting level
// TBD: apply weight (multiplier) to partially lit vehicles? // TBD: apply weight (multiplier) to partially lit vehicles?
ConsistShade += ( p->fShade > 0.0 ? p->fShade : 1.0 ); ConsistShade += ( p->fShade > 0.0 ? p->fShade : 1.0 );

View File

@@ -1172,10 +1172,10 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
if (TestFlag(MoverParameters->iLights[end::rear], light::auxiliary_right)) if (TestFlag(MoverParameters->iLights[end::rear], light::auxiliary_right))
{ {
if( DimHeadlights ) { if( DimHeadlights ) {
m_headlamp22.TurnxOnWithOnAsFallback(); m_headsignal22.TurnxOnWithOnAsFallback();
} }
else { else {
m_headlamp22.TurnOn(); m_headsignal22.TurnOn();
} }
btnOn = true; btnOn = true;
} }
@@ -4139,6 +4139,14 @@ void TDynamicObject::RenderSounds() {
// brake cylinder piston // brake cylinder piston
auto const brakepressureratio { std::max( 0.0, MoverParameters->BrakePress ) / std::max( 1.0, MoverParameters->MaxBrakePress[ 3 ] ) }; auto const brakepressureratio { std::max( 0.0, MoverParameters->BrakePress ) / std::max( 1.0, MoverParameters->MaxBrakePress[ 3 ] ) };
if( m_lastbrakepressure != -1.f ) { if( m_lastbrakepressure != -1.f ) {
// HACK: potentially reset playback of opening bookend sounds
if( false == m_brakecylinderpistonadvance.is_playing() ) {
m_brakecylinderpistonadvance.stop();
}
if( false == m_brakecylinderpistonrecede.is_playing() ) {
m_brakecylinderpistonrecede.stop();
}
// actual sound playback
auto const quantizedratio { static_cast<int>( 15 * brakepressureratio ) }; auto const quantizedratio { static_cast<int>( 15 * brakepressureratio ) };
auto const lastbrakepressureratio { std::max( 0.f, m_lastbrakepressure ) / std::max( 1.0, MoverParameters->MaxBrakePress[ 3 ] ) }; auto const lastbrakepressureratio { std::max( 0.f, m_lastbrakepressure ) / std::max( 1.0, MoverParameters->MaxBrakePress[ 3 ] ) };
auto const quantizedratiochange { quantizedratio - static_cast<int>( 15 * lastbrakepressureratio ) }; auto const quantizedratiochange { quantizedratio - static_cast<int>( 15 * lastbrakepressureratio ) };

View File

@@ -1450,9 +1450,10 @@ public:
bool Mains = false; /*polozenie glownego wylacznika*/ bool Mains = false; /*polozenie glownego wylacznika*/
double MainsInitTime{ 0.0 }; // config, initialization time (in seconds) of the main circuit after it receives power, before it can be closed double MainsInitTime{ 0.0 }; // config, initialization time (in seconds) of the main circuit after it receives power, before it can be closed
double MainsInitTimeCountdown{ 0.0 }; // current state of main circuit initialization, remaining time (in seconds) until it's ready double MainsInitTimeCountdown{ 0.0 }; // current state of main circuit initialization, remaining time (in seconds) until it's ready
bool LineBreakerClosesAtNoPowerPosOnly{ false }; bool LineBreakerClosesOnlyAtNoPowerPos{ false };
bool ControlPressureSwitch{ false }; // activates if the main pipe and/or brake cylinder pressure aren't within operational levels bool ControlPressureSwitch{ false }; // activates if the main pipe and/or brake cylinder pressure aren't within operational levels
bool HasControlPressureSwitch{ true }; bool HasControlPressureSwitch{ true };
bool ReleaserEnabledOnlyAtNoPowerPos{ false };
int MainCtrlPos = 0; /*polozenie glownego nastawnika*/ int MainCtrlPos = 0; /*polozenie glownego nastawnika*/
int ScndCtrlPos = 0; /*polozenie dodatkowego nastawnika*/ int ScndCtrlPos = 0; /*polozenie dodatkowego nastawnika*/
int LightsPos = 0; /*polozenie przelacznika wielopozycyjnego swiatel*/ int LightsPos = 0; /*polozenie przelacznika wielopozycyjnego swiatel*/

View File

@@ -3510,7 +3510,7 @@ bool TMoverParameters::MainSwitchCheck() const {
&& ( true == NoVoltRelay ) && ( true == NoVoltRelay )
&& ( true == OvervoltageRelay ) && ( true == OvervoltageRelay )
&& ( LastSwitchingTime > CtrlDelay ) && ( LastSwitchingTime > CtrlDelay )
&& ( HasCamshaft ? IsMainCtrlActualNoPowerPos() : ( LineBreakerClosesAtNoPowerPosOnly ? IsMainCtrlNoPowerPos() : true ) ) && ( HasCamshaft ? IsMainCtrlActualNoPowerPos() : ( LineBreakerClosesOnlyAtNoPowerPos ? IsMainCtrlNoPowerPos() : true ) )
&& ( false == TestFlag( DamageFlag, dtrain_out ) ) && ( false == TestFlag( DamageFlag, dtrain_out ) )
&& ( false == TestFlag( EngDmgFlag, 1 ) ) ); && ( false == TestFlag( EngDmgFlag, 1 ) ) );
} }
@@ -3820,7 +3820,7 @@ bool TMoverParameters::BrakeReleaser(int state)
bool OK = true; //false tylko jeśli nie uda się wysłać, GF 20161124 bool OK = true; //false tylko jeśli nie uda się wysłać, GF 20161124
if( state != 0 ) { if( state != 0 ) {
// additional limitations imposed by pressure switch // additional limitations imposed by pressure switch
if( ( false == ControlPressureSwitch ) || ( true == IsMainCtrlNoPowerPos() ) ) { if( ( false == ControlPressureSwitch ) || ( false == ReleaserEnabledOnlyAtNoPowerPos ) || ( true == IsMainCtrlNoPowerPos() ) ) {
Hamulec->Releaser( state ); Hamulec->Releaser( state );
} }
} }
@@ -9751,6 +9751,10 @@ void TMoverParameters::LoadFIZ_Brake( std::string const &line ) {
// the parameter is provided in form of a multiplier, where 1.0 means the default rate of 0.01 // the parameter is provided in form of a multiplier, where 1.0 means the default rate of 0.01
AirLeakRate *= 0.01; AirLeakRate *= 0.01;
} }
extract_value(
ReleaserEnabledOnlyAtNoPowerPos, "ReleaserPowerPosLock", line,
( ( EngineType == TEngineType::DieselEngine ) || ( EngineType == TEngineType::DieselElectric ) ) ? "yes" : "no" );
} }
void TMoverParameters::LoadFIZ_Doors( std::string const &line ) { void TMoverParameters::LoadFIZ_Doors( std::string const &line ) {

View File

@@ -588,7 +588,7 @@ dictionary_source *TTrain::GetTrainState() {
dict->insert( "speedctrlstandby", mvOccupied->SpeedCtrlUnit.Standby ); dict->insert( "speedctrlstandby", mvOccupied->SpeedCtrlUnit.Standby );
// brakes // brakes
dict->insert( "manual_brake", ( mvOccupied->ManualBrakePos > 0 ) ); dict->insert( "manual_brake", ( mvOccupied->ManualBrakePos > 0 ) );
bool const bEP = ( mvControlled->LocHandle->GetCP() > 0.2 ) || ( fEIMParams[ 0 ][ 2 ] > 0.01 ); bool const bEP = ( mvControlled->LocHandle->GetCP() > 0.2 ) || ( fEIMParams[ 0 ][ 5 ] > 0.01 );
dict->insert( "dir_brake", bEP ); dict->insert( "dir_brake", bEP );
bool bPN; bool bPN;
if( ( typeid( *mvOccupied->Hamulec ) == typeid( TLSt ) ) if( ( typeid( *mvOccupied->Hamulec ) == typeid( TLSt ) )