mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 12:49:18 +02:00
Blinking door permition signal lights
This commit is contained in:
@@ -6022,6 +6022,7 @@ TController::determine_consist_state() {
|
|||||||
mvOccupied->PipePress < std::max( 3.9, mvOccupied->BrakePressureActual.PipePressureVal ) + 0.1 );
|
mvOccupied->PipePress < std::max( 3.9, mvOccupied->BrakePressureActual.PipePressureVal ) + 0.1 );
|
||||||
fAccGravity = 0.0; // przyspieszenie wynikające z pochylenia
|
fAccGravity = 0.0; // przyspieszenie wynikające z pochylenia
|
||||||
IsAnyCouplerStretched = false;
|
IsAnyCouplerStretched = false;
|
||||||
|
IsAnyDoorOnlyOpen[ side::right ] = IsAnyDoorOnlyOpen[ side::left ] = false;
|
||||||
IsAnyDoorOpen[ side::right ] = IsAnyDoorOpen[ side::left ] = false;
|
IsAnyDoorOpen[ side::right ] = IsAnyDoorOpen[ side::left ] = false;
|
||||||
IsAnyDoorPermitActive[ side::right ] = IsAnyDoorPermitActive[ side::left ] = false;
|
IsAnyDoorPermitActive[ side::right ] = IsAnyDoorPermitActive[ side::left ] = false;
|
||||||
ConsistShade = 0.0;
|
ConsistShade = 0.0;
|
||||||
@@ -6081,6 +6082,10 @@ TController::determine_consist_state() {
|
|||||||
IsAnyDoorOpen[ side::right ] |= ( false == rightdoor.is_closed );
|
IsAnyDoorOpen[ side::right ] |= ( false == rightdoor.is_closed );
|
||||||
IsAnyDoorOpen[ side::left ] |= ( false == leftdoor.is_closed );
|
IsAnyDoorOpen[ side::left ] |= ( false == leftdoor.is_closed );
|
||||||
}
|
}
|
||||||
|
if (vehicle->Doors.close_control != control_t::autonomous) {
|
||||||
|
IsAnyDoorOnlyOpen[ side::right ] |= ( false == rightdoor.is_door_closed );
|
||||||
|
IsAnyDoorOnlyOpen[ side::left ] |= ( false == leftdoor.is_door_closed );
|
||||||
|
}
|
||||||
if( vehicle->Doors.permit_needed ) {
|
if( vehicle->Doors.permit_needed ) {
|
||||||
IsAnyDoorPermitActive[ side::right ] |= rightdoor.open_permit;
|
IsAnyDoorPermitActive[ side::right ] |= rightdoor.open_permit;
|
||||||
IsAnyDoorPermitActive[ side::left ] |= leftdoor.open_permit;
|
IsAnyDoorPermitActive[ side::left ] |= leftdoor.open_permit;
|
||||||
|
|||||||
1
Driver.h
1
Driver.h
@@ -594,6 +594,7 @@ private:
|
|||||||
TDynamicObject *pVehicles[ 2 ]; // skrajne pojazdy w składzie (niekoniecznie bezpośrednio sterowane)
|
TDynamicObject *pVehicles[ 2 ]; // skrajne pojazdy w składzie (niekoniecznie bezpośrednio sterowane)
|
||||||
bool DoesAnyDoorNeedOpening{ false };
|
bool DoesAnyDoorNeedOpening{ false };
|
||||||
bool IsAnyDoorOpen[ 2 ]; // state of door in the consist
|
bool IsAnyDoorOpen[ 2 ]; // state of door in the consist
|
||||||
|
bool IsAnyDoorOnlyOpen[ 2 ]; // state of door in the consist regardless of step
|
||||||
bool IsAnyDoorPermitActive[ 2 ]; // state of door permit in the consist
|
bool IsAnyDoorPermitActive[ 2 ]; // state of door permit in the consist
|
||||||
bool IsAnyLineBreakerOpen{ false }; // state of line breaker in all powered vehicles under control
|
bool IsAnyLineBreakerOpen{ false }; // state of line breaker in all powered vehicles under control
|
||||||
bool IsAnyConverterOverloadRelayOpen{ false }; // state of converter overload relays in all vehicles under control
|
bool IsAnyConverterOverloadRelayOpen{ false }; // state of converter overload relays in all vehicles under control
|
||||||
|
|||||||
@@ -901,6 +901,7 @@ private:
|
|||||||
float step_position { 0.f }; // current shift of the movable step from the retracted position
|
float step_position { 0.f }; // current shift of the movable step from the retracted position
|
||||||
// ld outputs
|
// ld outputs
|
||||||
bool is_closed { true }; // the door is fully closed
|
bool is_closed { true }; // the door is fully closed
|
||||||
|
bool is_door_closed { true }; // the door is fully closed, step doesn't matter
|
||||||
bool is_closing { false }; // the door is currently closing
|
bool is_closing { false }; // the door is currently closing
|
||||||
bool is_opening { false }; // the door is currently opening
|
bool is_opening { false }; // the door is currently opening
|
||||||
bool is_open { false }; // the door is fully open
|
bool is_open { false }; // the door is fully open
|
||||||
@@ -1457,6 +1458,7 @@ public:
|
|||||||
std::array<cooling_fan, 2> MotorBlowers;
|
std::array<cooling_fan, 2> MotorBlowers;
|
||||||
door_data Doors;
|
door_data Doors;
|
||||||
float DoorsOpenWithPermitAfter { -1.f }; // remote open if permit button is held for specified time. NOTE: separate from door data as its cab control thing
|
float DoorsOpenWithPermitAfter { -1.f }; // remote open if permit button is held for specified time. NOTE: separate from door data as its cab control thing
|
||||||
|
int DoorsPermitLightBlinking { 0 }; //when the doors permit signal light is blinking
|
||||||
|
|
||||||
int BrakeCtrlPos = -2; /*nastawa hamulca zespolonego*/
|
int BrakeCtrlPos = -2; /*nastawa hamulca zespolonego*/
|
||||||
double BrakeCtrlPosR = 0.0; /*nastawa hamulca zespolonego - plynna dla FV4a*/
|
double BrakeCtrlPosR = 0.0; /*nastawa hamulca zespolonego - plynna dla FV4a*/
|
||||||
|
|||||||
@@ -8539,6 +8539,7 @@ TMoverParameters::update_doors( double const Deltatime ) {
|
|||||||
door.is_closed =
|
door.is_closed =
|
||||||
( door.position <= 0.f )
|
( door.position <= 0.f )
|
||||||
&& ( door.step_position <= 0.f );
|
&& ( door.step_position <= 0.f );
|
||||||
|
door.is_door_closed = (door.position <= 0.f);
|
||||||
|
|
||||||
door.local_open = door.local_open && ( false == door.is_open ) && ( ( false == Doors.permit_needed ) || door.open_permit );
|
door.local_open = door.local_open && ( false == door.is_open ) && ( ( false == Doors.permit_needed ) || door.open_permit );
|
||||||
door.remote_open = ( door.remote_open || Doors.remote_only ) && ( false == door.is_open ) && ( ( false == Doors.permit_needed ) || door.open_permit );
|
door.remote_open = ( door.remote_open || Doors.remote_only ) && ( false == door.is_open ) && ( ( false == Doors.permit_needed ) || door.open_permit );
|
||||||
@@ -10133,6 +10134,7 @@ void TMoverParameters::LoadFIZ_Doors( std::string const &line ) {
|
|||||||
extract_value( MirrorVelClose, "MirrorVelClose", line, "");
|
extract_value( MirrorVelClose, "MirrorVelClose", line, "");
|
||||||
|
|
||||||
extract_value( DoorsOpenWithPermitAfter, "DoorOpenWithPermit", line, "" );
|
extract_value( DoorsOpenWithPermitAfter, "DoorOpenWithPermit", line, "" );
|
||||||
|
extract_value( DoorsPermitLightBlinking, "DoorsPermitLightBlinking", line, "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMoverParameters::LoadFIZ_BuffCoupl( std::string const &line, int const Index ) {
|
void TMoverParameters::LoadFIZ_BuffCoupl( std::string const &line, int const Index ) {
|
||||||
|
|||||||
22
Train.cpp
22
Train.cpp
@@ -6514,6 +6514,20 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
m_doorpermits = (
|
m_doorpermits = (
|
||||||
DynamicObject->Mechanik->IsAnyDoorPermitActive[ side::right ]
|
DynamicObject->Mechanik->IsAnyDoorPermitActive[ side::right ]
|
||||||
|| DynamicObject->Mechanik->IsAnyDoorPermitActive[ side::left ] );
|
|| DynamicObject->Mechanik->IsAnyDoorPermitActive[ side::left ] );
|
||||||
|
m_doorspermitleft = mvOccupied->Doors.instances[(cab_to_end() == end::front ? side::left : side::right)].open_permit
|
||||||
|
&& ((simulation::Time.data().wSecond % 2 < 1)
|
||||||
|
|| (mvOccupied->DoorsPermitLightBlinking < 1)
|
||||||
|
|| ((mvOccupied->DoorsPermitLightBlinking < 2)
|
||||||
|
&& (DynamicObject->Mechanik->IsAnyDoorOpen[(cab_to_end() == end::front ? side::left : side::right)])
|
||||||
|
|| ((mvOccupied->DoorsPermitLightBlinking < 3)
|
||||||
|
&& DynamicObject->Mechanik->IsAnyDoorOnlyOpen[(cab_to_end() == end::front ? side::left : side::right)])));
|
||||||
|
m_doorspermitright = mvOccupied->Doors.instances[(cab_to_end() == end::front ? side::right : side::left)].open_permit
|
||||||
|
&& ((simulation::Time.data().wSecond % 2 < 1)
|
||||||
|
|| (mvOccupied->DoorsPermitLightBlinking < 1)
|
||||||
|
|| ((mvOccupied->DoorsPermitLightBlinking < 2)
|
||||||
|
&& (DynamicObject->Mechanik->IsAnyDoorOpen[(cab_to_end() == end::front ? side::right : side::left)])
|
||||||
|
|| ((mvOccupied->DoorsPermitLightBlinking < 3)
|
||||||
|
&& DynamicObject->Mechanik->IsAnyDoorOnlyOpen[(cab_to_end() == end::front ? side::right : side::left)])));
|
||||||
}
|
}
|
||||||
m_dirforward = ( mvControlled->DirActive > 0 );
|
m_dirforward = ( mvControlled->DirActive > 0 );
|
||||||
m_dirneutral = ( mvControlled->DirActive == 0 );
|
m_dirneutral = ( mvControlled->DirActive == 0 );
|
||||||
@@ -9621,8 +9635,8 @@ bool TTrain::initialize_button(cParser &Parser, std::string const &Label, int co
|
|||||||
// TODO: move viable dedicated lights to the automatic light array
|
// TODO: move viable dedicated lights to the automatic light array
|
||||||
std::unordered_map<std::string, bool const *> const autolights = {
|
std::unordered_map<std::string, bool const *> const autolights = {
|
||||||
{ "i-doors:", &m_doors },
|
{ "i-doors:", &m_doors },
|
||||||
{ "i-doorpermit_left:", &mvOccupied->Doors.instances[ ( cab_to_end() == end::front ? side::left : side::right ) ].open_permit },
|
{ "i-doorpermit_left:", &m_doorspermitleft },
|
||||||
{ "i-doorpermit_right:", &mvOccupied->Doors.instances[ ( cab_to_end() == end::front ? side::right : side::left ) ].open_permit },
|
{ "i-doorpermit_right:", &m_doorspermitright },
|
||||||
{ "i-doorpermit_any:", &m_doorpermits },
|
{ "i-doorpermit_any:", &m_doorpermits },
|
||||||
{ "i-doorstep:", &mvOccupied->Doors.step_enabled },
|
{ "i-doorstep:", &mvOccupied->Doors.step_enabled },
|
||||||
{ "i-mainpipelock:", &mvOccupied->LockPipe },
|
{ "i-mainpipelock:", &mvOccupied->LockPipe },
|
||||||
@@ -9868,8 +9882,8 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
|
|||||||
{ "speedbutton7:", { ggSpeedCtrlButtons[ 7 ], &mvOccupied->SpeedCtrlUnit.IsActive } },
|
{ "speedbutton7:", { ggSpeedCtrlButtons[ 7 ], &mvOccupied->SpeedCtrlUnit.IsActive } },
|
||||||
{ "speedbutton8:", { ggSpeedCtrlButtons[ 8 ], &mvOccupied->SpeedCtrlUnit.IsActive } },
|
{ "speedbutton8:", { ggSpeedCtrlButtons[ 8 ], &mvOccupied->SpeedCtrlUnit.IsActive } },
|
||||||
{ "speedbutton9:", { ggSpeedCtrlButtons[ 9 ], &mvOccupied->SpeedCtrlUnit.IsActive } },
|
{ "speedbutton9:", { ggSpeedCtrlButtons[ 9 ], &mvOccupied->SpeedCtrlUnit.IsActive } },
|
||||||
{ "doorleftpermit_sw:", { ggDoorLeftPermitButton, &mvOccupied->Doors.instances[ ( cab_to_end() == end::front ? side::left : side::right ) ].open_permit } },
|
{ "doorleftpermit_sw:", { ggDoorLeftPermitButton, &m_doorspermitleft } },
|
||||||
{ "doorrightpermit_sw:", { ggDoorRightPermitButton, &mvOccupied->Doors.instances[ ( cab_to_end() == end::front ? side::right : side::left ) ].open_permit } },
|
{ "doorrightpermit_sw:", { ggDoorRightPermitButton, &m_doorspermitright } },
|
||||||
{ "dooralloff_sw:", { ggDoorAllOffButton, &m_doors } },
|
{ "dooralloff_sw:", { ggDoorAllOffButton, &m_doors } },
|
||||||
{ "doorstep_sw:", { ggDoorStepButton, &mvOccupied->Doors.step_enabled } },
|
{ "doorstep_sw:", { ggDoorStepButton, &mvOccupied->Doors.step_enabled } },
|
||||||
{ "dirforward_bt:", { ggDirForwardButton, &m_dirforward } },
|
{ "dirforward_bt:", { ggDirForwardButton, &m_dirforward } },
|
||||||
|
|||||||
2
Train.h
2
Train.h
@@ -840,6 +840,8 @@ private:
|
|||||||
float m_distancecounter { -1.f }; // distance traveled since meter was activated or -1 if inactive
|
float m_distancecounter { -1.f }; // distance traveled since meter was activated or -1 if inactive
|
||||||
double m_brakehandlecp{ 0.0 };
|
double m_brakehandlecp{ 0.0 };
|
||||||
bool m_doors{ false }; // helper, true if any door is open
|
bool m_doors{ false }; // helper, true if any door is open
|
||||||
|
bool m_doorspermitleft{ false }; // helper, true if door is open, blinking if door is pemitted
|
||||||
|
bool m_doorspermitright{ false }; // helper, true if door is open, blinking if door is pemitted
|
||||||
bool m_dirforward{ false }; // helper, true if direction set to forward
|
bool m_dirforward{ false }; // helper, true if direction set to forward
|
||||||
bool m_dirneutral{ false }; // helper, true if direction set to neutral
|
bool m_dirneutral{ false }; // helper, true if direction set to neutral
|
||||||
bool m_dirbackward{ false }; // helper, true if direction set to backward
|
bool m_dirbackward{ false }; // helper, true if direction set to backward
|
||||||
|
|||||||
Reference in New Issue
Block a user