mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-24 00:49:18 +02:00
Reworked some actions durin cab (de)activation
This commit is contained in:
26
DynObj.cpp
26
DynObj.cpp
@@ -3947,6 +3947,26 @@ bool TDynamicObject::Update(double dt, double dt1)
|
|||||||
toggle_lights();
|
toggle_lights();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (MoverParameters->InactiveCabPantsCheck)
|
||||||
|
{
|
||||||
|
auto p = FindPantographCarrier();
|
||||||
|
bool isAnyPantUp = false;
|
||||||
|
if (p)
|
||||||
|
{
|
||||||
|
for each (auto item in p->MoverParameters->Pantographs)
|
||||||
|
{
|
||||||
|
isAnyPantUp |= item.is_active;
|
||||||
|
}
|
||||||
|
if (isAnyPantUp)
|
||||||
|
{
|
||||||
|
MoverParameters->OperatePantographValve(end::front, operation_t::enable);
|
||||||
|
MoverParameters->OperatePantographValve(end::rear, operation_t::enable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MoverParameters->InactiveCabPantsCheck = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (MoverParameters->DerailReason > 0)
|
if (MoverParameters->DerailReason > 0)
|
||||||
{
|
{
|
||||||
switch (MoverParameters->DerailReason)
|
switch (MoverParameters->DerailReason)
|
||||||
@@ -6855,11 +6875,13 @@ void TDynamicObject::Damage(char flag)
|
|||||||
void TDynamicObject::SetLights() {
|
void TDynamicObject::SetLights() {
|
||||||
|
|
||||||
auto const isfrontcaboccupied { MoverParameters->CabOccupied * DirectionGet() >= 0 };
|
auto const isfrontcaboccupied { MoverParameters->CabOccupied * DirectionGet() >= 0 };
|
||||||
|
int const automaticmarkers { MoverParameters->CabActive == 0 && ( MoverParameters->InactiveCabFlag & activation::redmarkers )
|
||||||
|
? light::redmarker_left + light::redmarker_right : 0 };
|
||||||
int const front { ( isfrontcaboccupied ? end::front : end::rear ) };
|
int const front { ( isfrontcaboccupied ? end::front : end::rear ) };
|
||||||
int const rear { 1 - front };
|
int const rear { 1 - front };
|
||||||
auto const lightpos { MoverParameters->LightsPos - 1 };
|
auto const lightpos { MoverParameters->LightsPos - 1 };
|
||||||
auto const frontlights { MoverParameters->Lights[ front ][ lightpos ] };
|
auto const frontlights { automaticmarkers > 0 ? automaticmarkers : MoverParameters->Lights[ front ][ lightpos ] };
|
||||||
auto const rearlights { MoverParameters->Lights[ rear ][ lightpos ] };
|
auto const rearlights { automaticmarkers > 0 ? automaticmarkers : MoverParameters->Lights[ rear ][ lightpos ] };
|
||||||
auto *vehicle { GetFirstDynamic( MoverParameters->CabOccupied >= 0 ? end::front : end::rear, coupling::control ) };
|
auto *vehicle { GetFirstDynamic( MoverParameters->CabOccupied >= 0 ? end::front : end::rear, coupling::control ) };
|
||||||
while( vehicle != nullptr ) {
|
while( vehicle != nullptr ) {
|
||||||
// set lights on given side if there's no coupling with another vehicle, turn them off otherwise
|
// set lights on given side if there's no coupling with another vehicle, turn them off otherwise
|
||||||
|
|||||||
@@ -267,6 +267,17 @@ enum relay_t {
|
|||||||
electrodynamicbrakesoverload = 1 << 7,
|
electrodynamicbrakesoverload = 1 << 7,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// functions during activation/deactivation
|
||||||
|
enum activation {
|
||||||
|
emergencybrake = 1 << 0,
|
||||||
|
mirrors = 1 << 1,
|
||||||
|
pantographsup = 1 << 2,
|
||||||
|
redmarkers = 1 << 3,
|
||||||
|
doorpermition = 1 << 4,
|
||||||
|
springbrakeon = 1 << 5,
|
||||||
|
springbrakeoff = 1 << 6,
|
||||||
|
};
|
||||||
|
|
||||||
//szczególne typy pojazdów (inna obsługa) dla zmiennej TrainType
|
//szczególne typy pojazdów (inna obsługa) dla zmiennej TrainType
|
||||||
//zamienione na flagi bitowe, aby szybko wybierać grupę (np. EZT+SZT)
|
//zamienione na flagi bitowe, aby szybko wybierać grupę (np. EZT+SZT)
|
||||||
// TODO: convert to enums, they're used as specific checks anyway
|
// TODO: convert to enums, they're used as specific checks anyway
|
||||||
@@ -1512,7 +1523,8 @@ public:
|
|||||||
int CabOccupied = 0; //numer kabiny, w ktorej jest obsada (zwykle jedna na skład) // TODO: move to TController
|
int CabOccupied = 0; //numer kabiny, w ktorej jest obsada (zwykle jedna na skład) // TODO: move to TController
|
||||||
bool CabMaster = false; //czy pojazd jest nadrzędny w składzie
|
bool CabMaster = false; //czy pojazd jest nadrzędny w składzie
|
||||||
bool AutomaticCabActivation = true; //czy zmostkowany rozrzad przelacza sie sam przy zmianie kabiny
|
bool AutomaticCabActivation = true; //czy zmostkowany rozrzad przelacza sie sam przy zmianie kabiny
|
||||||
bool InactivaCabEmergencyBrake = false; //czy bez aktywacji włącza się nagłe
|
int InactiveCabFlag = 0; //co sie dzieje przy dezaktywacji kabiny
|
||||||
|
bool InactiveCabPantsCheck = false; //niech DynamicObject sprawdzi pantografy
|
||||||
double LastSwitchingTime = 0.0; /*czas ostatniego przelaczania czegos*/
|
double LastSwitchingTime = 0.0; /*czas ostatniego przelaczania czegos*/
|
||||||
int WarningSignal = 0; // 0: nie trabi, 1,2,4: trabi
|
int WarningSignal = 0; // 0: nie trabi, 1,2,4: trabi
|
||||||
bool DepartureSignal = false; /*sygnal odjazdu*/
|
bool DepartureSignal = false; /*sygnal odjazdu*/
|
||||||
|
|||||||
@@ -2689,6 +2689,10 @@ bool TMoverParameters::CabActivisation( bool const Enforce )
|
|||||||
CabMaster = true;
|
CabMaster = true;
|
||||||
SecuritySystem.Status |= s_waiting; // activate the alerter TODO: make it part of control based cab selection
|
SecuritySystem.Status |= s_waiting; // activate the alerter TODO: make it part of control based cab selection
|
||||||
SendCtrlToNext("CabActivisation", 1, CabActive);
|
SendCtrlToNext("CabActivisation", 1, CabActive);
|
||||||
|
if (InactiveCabFlag & activation::springbrakeoff)
|
||||||
|
{
|
||||||
|
SpringBrakeActivate(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -2710,6 +2714,20 @@ bool TMoverParameters::CabDeactivisation( bool const Enforce )
|
|||||||
OK = Enforce || ((CabActive == CabOccupied) && CabMaster); // o ile obsada jest w kabinie ze sterowaniem
|
OK = Enforce || ((CabActive == CabOccupied) && CabMaster); // o ile obsada jest w kabinie ze sterowaniem
|
||||||
if (OK)
|
if (OK)
|
||||||
{
|
{
|
||||||
|
if (InactiveCabFlag & activation::springbrakeon)
|
||||||
|
{
|
||||||
|
SpringBrakeActivate(true);
|
||||||
|
}
|
||||||
|
if (InactiveCabFlag & activation::pantographsup)
|
||||||
|
{
|
||||||
|
InactiveCabPantsCheck = true;
|
||||||
|
}
|
||||||
|
if (InactiveCabFlag & activation::doorpermition)
|
||||||
|
{
|
||||||
|
PermitDoors(side::right, true, range_t::consist);
|
||||||
|
PermitDoors(side::left, true, range_t::consist);
|
||||||
|
}
|
||||||
|
|
||||||
CabActive = 0;
|
CabActive = 0;
|
||||||
DirAbsolute = DirActive * CabActive;
|
DirAbsolute = DirActive * CabActive;
|
||||||
CabMaster = false;
|
CabMaster = false;
|
||||||
@@ -4455,7 +4473,8 @@ void TMoverParameters::UpdatePipePressure(double dt)
|
|||||||
|| ( true == TestFlag( EngDmgFlag, 32 ) )
|
|| ( true == TestFlag( EngDmgFlag, 32 ) )
|
||||||
*/
|
*/
|
||||||
|| ( true == s_CAtestebrake )
|
|| ( true == s_CAtestebrake )
|
||||||
|| ( ( 0 == CabActive ) && InactivaCabEmergencyBrake )
|
|| ( ( 0 == CabActive )
|
||||||
|
&& ( InactiveCabFlag & activation::emergencybrake ) )
|
||||||
|| ( ( SpringBrakeDriveEmergencyVel >= 0 )
|
|| ( ( SpringBrakeDriveEmergencyVel >= 0 )
|
||||||
&& ( Vel > SpringBrakeDriveEmergencyVel )
|
&& ( Vel > SpringBrakeDriveEmergencyVel )
|
||||||
&& ( SpringBrake.IsActive ) )
|
&& ( SpringBrake.IsActive ) )
|
||||||
@@ -10390,7 +10409,7 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) {
|
|||||||
extract_value( BackwardsBranchesAllowed, "BackwardsBranchesAllowed", line, "" );
|
extract_value( BackwardsBranchesAllowed, "BackwardsBranchesAllowed", line, "" );
|
||||||
|
|
||||||
extract_value( AutomaticCabActivation, "AutomaticCabActivation", line, "" );
|
extract_value( AutomaticCabActivation, "AutomaticCabActivation", line, "" );
|
||||||
extract_value( InactivaCabEmergencyBrake, "InactivaCabEmergencyBrake", line, "" );
|
extract_value( InactiveCabFlag, "InactiveCabFlag", line, "" );
|
||||||
|
|
||||||
extract_value( StopBrakeDecc, "SBD", line, "" );
|
extract_value( StopBrakeDecc, "SBD", line, "" );
|
||||||
extract_value( ReleaseParkingBySpringBrake, "ReleaseParkingBySpringBrake", line, "" );
|
extract_value( ReleaseParkingBySpringBrake, "ReleaseParkingBySpringBrake", line, "" );
|
||||||
|
|||||||
@@ -2416,6 +2416,9 @@ void TTrain::OnCommand_cabactivationdisable(TTrain *Train, command_data const &C
|
|||||||
}
|
}
|
||||||
|
|
||||||
Train->mvOccupied->CabDeactivisation();
|
Train->mvOccupied->CabDeactivisation();
|
||||||
|
if ((Train->mvOccupied->LightsPosNo > 0) && (Train->mvOccupied->InactiveCabFlag & activation::redmarkers)) {
|
||||||
|
Train->Dynamic()->SetLights();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (Command.action == GLFW_RELEASE) {
|
else if (Command.action == GLFW_RELEASE) {
|
||||||
if (Train->ggCabActivationButton.type() == TGaugeType::push) {
|
if (Train->ggCabActivationButton.type() == TGaugeType::push) {
|
||||||
|
|||||||
Reference in New Issue
Block a user