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

Reworked some actions durin cab (de)activation

This commit is contained in:
Królik Uszasty
2022-02-20 22:41:31 +01:00
parent 3da4a42156
commit 827a3394df
4 changed files with 61 additions and 5 deletions

View File

@@ -267,6 +267,17 @@ enum relay_t {
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
//zamienione na flagi bitowe, aby szybko wybierać grupę (np. EZT+SZT)
// 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
bool CabMaster = false; //czy pojazd jest nadrzędny w składzie
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*/
int WarningSignal = 0; // 0: nie trabi, 1,2,4: trabi
bool DepartureSignal = false; /*sygnal odjazdu*/

View File

@@ -2689,6 +2689,10 @@ bool TMoverParameters::CabActivisation( bool const Enforce )
CabMaster = true;
SecuritySystem.Status |= s_waiting; // activate the alerter TODO: make it part of control based cab selection
SendCtrlToNext("CabActivisation", 1, CabActive);
if (InactiveCabFlag & activation::springbrakeoff)
{
SpringBrakeActivate(false);
}
}
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
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;
DirAbsolute = DirActive * CabActive;
CabMaster = false;
@@ -4455,7 +4473,8 @@ void TMoverParameters::UpdatePipePressure(double dt)
|| ( true == TestFlag( EngDmgFlag, 32 ) )
*/
|| ( true == s_CAtestebrake )
|| ( ( 0 == CabActive ) && InactivaCabEmergencyBrake )
|| ( ( 0 == CabActive )
&& ( InactiveCabFlag & activation::emergencybrake ) )
|| ( ( SpringBrakeDriveEmergencyVel >= 0 )
&& ( Vel > SpringBrakeDriveEmergencyVel )
&& ( SpringBrake.IsActive ) )
@@ -10390,7 +10409,7 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) {
extract_value( BackwardsBranchesAllowed, "BackwardsBranchesAllowed", line, "" );
extract_value( AutomaticCabActivation, "AutomaticCabActivation", line, "" );
extract_value( InactivaCabEmergencyBrake, "InactivaCabEmergencyBrake", line, "" );
extract_value( InactiveCabFlag, "InactiveCabFlag", line, "" );
extract_value( StopBrakeDecc, "SBD", line, "" );
extract_value( ReleaseParkingBySpringBrake, "ReleaseParkingBySpringBrake", line, "" );