mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 10:29:19 +02:00
Merge branch 'gfx-work' into sim
This commit is contained in:
101
Driver.cpp
101
Driver.cpp
@@ -2107,12 +2107,18 @@ bool TController::CheckVehicles(TOrders user)
|
|||||||
{ // sprawdzanie, czy jest głównym sterującym, żeby nie było konfliktu
|
{ // sprawdzanie, czy jest głównym sterującym, żeby nie było konfliktu
|
||||||
if (p->Mechanik) // jeśli ma obsadę
|
if (p->Mechanik) // jeśli ma obsadę
|
||||||
if (p->Mechanik != this) // ale chodzi o inny pojazd, niż aktualnie sprawdzający
|
if (p->Mechanik != this) // ale chodzi o inny pojazd, niż aktualnie sprawdzający
|
||||||
if (p->Mechanik->iDrivigFlags & movePrimary) // a tamten ma priorytet
|
if( p->Mechanik->iDrivigFlags & movePrimary ) {
|
||||||
if ((iDrivigFlags & movePrimary) && (mvOccupied->DirAbsolute) &&
|
// a tamten ma priorytet
|
||||||
(mvOccupied->BrakeCtrlPos >= -1)) // jeśli rządzi i ma kierunek
|
if( ( iDrivigFlags & movePrimary )
|
||||||
p->Mechanik->iDrivigFlags &= ~movePrimary; // dezaktywuje tamtego
|
&& ( mvOccupied->DirAbsolute )
|
||||||
else
|
&& ( mvOccupied->BrakeCtrlPos >= -1 ) ) {
|
||||||
|
// jeśli rządzi i ma kierunek
|
||||||
|
p->Mechanik->primary( false ); // dezaktywuje tamtego
|
||||||
|
}
|
||||||
|
else {
|
||||||
main = false; // nici z rządzenia
|
main = false; // nici z rządzenia
|
||||||
|
}
|
||||||
|
}
|
||||||
++iVehicles; // jest jeden pojazd więcej
|
++iVehicles; // jest jeden pojazd więcej
|
||||||
pVehicles[1] = p; // zapamiętanie ostatniego
|
pVehicles[1] = p; // zapamiętanie ostatniego
|
||||||
fLength += p->MoverParameters->Dim.L; // dodanie długości pojazdu
|
fLength += p->MoverParameters->Dim.L; // dodanie długości pojazdu
|
||||||
@@ -3636,6 +3642,18 @@ void TController::SetTimeControllers()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//6. UniversalBrakeButtons
|
||||||
|
//6.1. Checking flags for Over pressure
|
||||||
|
if (std::abs(BrakeCtrlPosition - gbh_FS)<0.5) {
|
||||||
|
UniversalBrakeButtons |= (TUniversalBrake::ub_HighPressure | TUniversalBrake::ub_Overload);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
UniversalBrakeButtons &= ~(TUniversalBrake::ub_HighPressure | TUniversalBrake::ub_Overload);
|
||||||
|
}
|
||||||
|
//6.2. Setting buttons
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
mvOccupied->UniversalBrakeButton(i, (UniversalBrakeButtons & mvOccupied->UniversalBrakeButtonFlag[i]));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void TController::CheckTimeControllers()
|
void TController::CheckTimeControllers()
|
||||||
@@ -5924,6 +5942,8 @@ TController::UpdateSituation(double dt) {
|
|||||||
// napełnianie uderzeniowe
|
// napełnianie uderzeniowe
|
||||||
if( ( mvOccupied->BrakeHandle == TBrakeHandle::FV4a )
|
if( ( mvOccupied->BrakeHandle == TBrakeHandle::FV4a )
|
||||||
|| ( mvOccupied->BrakeHandle == TBrakeHandle::MHZ_6P )
|
|| ( mvOccupied->BrakeHandle == TBrakeHandle::MHZ_6P )
|
||||||
|
|| (mvOccupied->BrakeHandle == TBrakeHandle::MHZ_K5P)
|
||||||
|
|| (mvOccupied->BrakeHandle == TBrakeHandle::MHZ_K8P)
|
||||||
|| ( mvOccupied->BrakeHandle == TBrakeHandle::M394 ) ) {
|
|| ( mvOccupied->BrakeHandle == TBrakeHandle::M394 ) ) {
|
||||||
|
|
||||||
if( /*GBH mvOccupied->BrakeCtrlPos*/BrakeCtrlPosition == -2 ) {
|
if( /*GBH mvOccupied->BrakeCtrlPos*/BrakeCtrlPosition == -2 ) {
|
||||||
@@ -5984,6 +6004,14 @@ TController::UpdateSituation(double dt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// unlocking main pipe
|
||||||
|
if ((AccDesired > -0.03)
|
||||||
|
&& (true == mvOccupied->LockPipe)) {
|
||||||
|
UniversalBrakeButtons |= TUniversalBrake::ub_UnlockPipe;
|
||||||
|
}
|
||||||
|
else if (false == mvOccupied->LockPipe) {
|
||||||
|
UniversalBrakeButtons &= ~TUniversalBrake::ub_UnlockPipe;
|
||||||
|
}
|
||||||
#if LOGVELOCITY
|
#if LOGVELOCITY
|
||||||
WriteLog("Dist=" + FloatToStrF(ActualProximityDist, ffFixed, 7, 1) +
|
WriteLog("Dist=" + FloatToStrF(ActualProximityDist, ffFixed, 7, 1) +
|
||||||
", VelDesired=" + FloatToStrF(VelDesired, ffFixed, 7, 1) +
|
", VelDesired=" + FloatToStrF(VelDesired, ffFixed, 7, 1) +
|
||||||
@@ -6806,43 +6834,56 @@ void TController::UpdateDelayFlag() {
|
|||||||
|
|
||||||
//-----------koniec skanowania semaforow
|
//-----------koniec skanowania semaforow
|
||||||
|
|
||||||
void TController::TakeControl(bool yes)
|
void TController::TakeControl( bool const Aidriver, bool const Forcevehiclecheck )
|
||||||
{ // przejęcie kontroli przez AI albo oddanie
|
{ // przejęcie kontroli przez AI albo oddanie
|
||||||
if (AIControllFlag == yes)
|
if (AIControllFlag == Aidriver)
|
||||||
return; // już jest jak ma być
|
return; // już jest jak ma być
|
||||||
if (yes) //żeby nie wykonywać dwa razy
|
if (Aidriver) //żeby nie wykonywać dwa razy
|
||||||
{ // teraz AI prowadzi
|
{ // teraz AI prowadzi
|
||||||
AIControllFlag = AIdriver;
|
AIControllFlag = AIdriver;
|
||||||
pVehicle->Controller = AIdriver;
|
pVehicle->Controller = AIdriver;
|
||||||
iDirection = 0; // kierunek jazdy trzeba dopiero zgadnąć
|
iDirection = 0; // kierunek jazdy trzeba dopiero zgadnąć
|
||||||
// gdy zgaszone światła, flaga podjeżdżania pod semafory pozostaje bez zmiany
|
|
||||||
// conditional below disabled to get around the situation where the AI train does nothing ever
|
|
||||||
// because it is waiting for orders which don't come until the engine is engaged, i.e. effectively never
|
|
||||||
if (OrderCurrentGet()) // jeśli coś robi
|
|
||||||
PrepareEngine(); // niech sprawdzi stan silnika
|
|
||||||
else // jeśli nic nie robi
|
|
||||||
if (pVehicle->iLights[ ( mvOccupied->CabNo < 0 ?
|
|
||||||
end::rear :
|
|
||||||
end::front ) ]
|
|
||||||
& (light::headlight_left | light::headlight_right | light::headlight_upper)) // któreś ze świateł zapalone?
|
|
||||||
{ // od wersji 357 oczekujemy podania komend dla AI przez scenerię
|
|
||||||
OrderNext(Prepare_engine);
|
|
||||||
if (pVehicle->iLights[mvOccupied->CabNo < 0 ? end::rear : end::front] & light::headlight_upper) // górne światło zapalone
|
|
||||||
OrderNext(Obey_train); // jazda pociągowa
|
|
||||||
else
|
|
||||||
OrderNext(Shunt); // jazda manewrowa
|
|
||||||
if (mvOccupied->Vel >= 1.0) // jeśli jedzie (dla 0.1 ma stać)
|
|
||||||
iDrivigFlags &= ~moveStopHere; // to ma nie czekać na sygnał, tylko jechać
|
|
||||||
else
|
|
||||||
iDrivigFlags |= moveStopHere; // a jak stoi, to niech czeka
|
|
||||||
}
|
|
||||||
CheckVehicles(); // ustawienie świateł
|
|
||||||
TableClear(); // ponowne utworzenie tabelki, bo człowiek mógł pojechać niezgodnie z sygnałami
|
TableClear(); // ponowne utworzenie tabelki, bo człowiek mógł pojechać niezgodnie z sygnałami
|
||||||
|
if( action() != TAction::actSleep ) {
|
||||||
|
// gdy zgaszone światła, flaga podjeżdżania pod semafory pozostaje bez zmiany
|
||||||
|
// conditional below disabled to get around the situation where the AI train does nothing ever
|
||||||
|
// because it is waiting for orders which don't come until the engine is engaged, i.e. effectively never
|
||||||
|
if( OrderCurrentGet() ) {
|
||||||
|
// jeśli coś robi
|
||||||
|
PrepareEngine(); // niech sprawdzi stan silnika
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// jeśli nic nie robi
|
||||||
|
if( pVehicle->iLights[ ( mvOccupied->CabNo < 0 ?
|
||||||
|
end::rear :
|
||||||
|
end::front ) ]
|
||||||
|
& ( light::headlight_left | light::headlight_right | light::headlight_upper ) ) // któreś ze świateł zapalone?
|
||||||
|
{ // od wersji 357 oczekujemy podania komend dla AI przez scenerię
|
||||||
|
OrderNext( Prepare_engine );
|
||||||
|
if( pVehicle->iLights[ mvOccupied->CabNo < 0 ? end::rear : end::front ] & light::headlight_upper ) // górne światło zapalone
|
||||||
|
OrderNext( Obey_train ); // jazda pociągowa
|
||||||
|
else
|
||||||
|
OrderNext( Shunt ); // jazda manewrowa
|
||||||
|
if( mvOccupied->Vel >= 1.0 ) // jeśli jedzie (dla 0.1 ma stać)
|
||||||
|
iDrivigFlags &= ~moveStopHere; // to ma nie czekać na sygnał, tylko jechać
|
||||||
|
else
|
||||||
|
iDrivigFlags |= moveStopHere; // a jak stoi, to niech czeka
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CheckVehicles(); // ustawienie świateł
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // a teraz użytkownik
|
{ // a teraz użytkownik
|
||||||
AIControllFlag = Humandriver;
|
AIControllFlag = Humandriver;
|
||||||
pVehicle->Controller = Humandriver;
|
pVehicle->Controller = Humandriver;
|
||||||
|
if( eAction == TAction::actSleep ) {
|
||||||
|
eAction = TAction::actUnknown;
|
||||||
|
}
|
||||||
|
if( Forcevehiclecheck ) {
|
||||||
|
// update consist ownership and other consist data
|
||||||
|
CheckVehicles();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
14
Driver.h
14
Driver.h
@@ -203,9 +203,13 @@ public:
|
|||||||
public:
|
public:
|
||||||
void UpdateSituation(double dt); // uruchamiac przynajmniej raz na sekundę
|
void UpdateSituation(double dt); // uruchamiac przynajmniej raz na sekundę
|
||||||
void MoveTo(TDynamicObject *to);
|
void MoveTo(TDynamicObject *to);
|
||||||
void TakeControl(bool yes);
|
void TakeControl(bool const Aidriver, bool const Forcevehiclecheck = false);
|
||||||
inline
|
inline
|
||||||
bool Primary() const {
|
bool primary( bool const Primary ) {
|
||||||
|
SetFlag( iDrivigFlags, ( Primary ? movePrimary : -movePrimary ) );
|
||||||
|
return primary(); }
|
||||||
|
inline
|
||||||
|
bool primary() const {
|
||||||
return ( ( iDrivigFlags & movePrimary ) != 0 ); };
|
return ( ( iDrivigFlags & movePrimary ) != 0 ); };
|
||||||
inline
|
inline
|
||||||
TMoverParameters const *Controlling() const {
|
TMoverParameters const *Controlling() const {
|
||||||
@@ -220,7 +224,10 @@ public:
|
|||||||
int Direction() const {
|
int Direction() const {
|
||||||
return iDirection; }
|
return iDirection; }
|
||||||
inline
|
inline
|
||||||
TAction GetAction() {
|
TAction & action() {
|
||||||
|
return eAction; }
|
||||||
|
inline
|
||||||
|
TAction const & action() const {
|
||||||
return eAction; }
|
return eAction; }
|
||||||
private:
|
private:
|
||||||
void Activation(); // umieszczenie obsady w odpowiednim członie
|
void Activation(); // umieszczenie obsady w odpowiednim członie
|
||||||
@@ -265,6 +272,7 @@ public:
|
|||||||
int iOverheadZero = 0; // suma bitowa jezdy bezprądowej, bity ustawiane przez pojazdy z podniesionymi pantografami
|
int iOverheadZero = 0; // suma bitowa jezdy bezprądowej, bity ustawiane przez pojazdy z podniesionymi pantografami
|
||||||
int iOverheadDown = 0; // suma bitowa opuszczenia pantografów, bity ustawiane przez pojazdy z podniesionymi pantografami
|
int iOverheadDown = 0; // suma bitowa opuszczenia pantografów, bity ustawiane przez pojazdy z podniesionymi pantografami
|
||||||
double BrakeCtrlPosition = 0.0; // intermediate position of main brake controller
|
double BrakeCtrlPosition = 0.0; // intermediate position of main brake controller
|
||||||
|
int UniversalBrakeButtons = 0.0; // flag of which universal buttons need to be pressed
|
||||||
int DizelPercentage = 0; // oczekiwane procenty jazdy/hamowania szynobusem
|
int DizelPercentage = 0; // oczekiwane procenty jazdy/hamowania szynobusem
|
||||||
int DizelPercentage_Speed = 0; // oczekiwane procenty jazdy/hamowania szynobusem w związku z osiąganiem VelDesired
|
int DizelPercentage_Speed = 0; // oczekiwane procenty jazdy/hamowania szynobusem w związku z osiąganiem VelDesired
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -979,8 +979,8 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
|||||||
|
|
||||||
if( ( false == bDisplayCab ) // edge case, lowpoly may act as a stand-in for the hi-fi cab, so make sure not to show the driver when inside
|
if( ( false == bDisplayCab ) // edge case, lowpoly may act as a stand-in for the hi-fi cab, so make sure not to show the driver when inside
|
||||||
&& ( Mechanik != nullptr )
|
&& ( Mechanik != nullptr )
|
||||||
&& ( ( Mechanik->GetAction() != TAction::actSleep )
|
&& ( ( Mechanik->action() != TAction::actSleep )
|
||||||
|| ( MoverParameters->Battery ) ) ) {
|
/* || ( MoverParameters->Battery ) */ ) ) {
|
||||||
// rysowanie figurki mechanika
|
// rysowanie figurki mechanika
|
||||||
btMechanik1.Turn( MoverParameters->ActiveCab > 0 );
|
btMechanik1.Turn( MoverParameters->ActiveCab > 0 );
|
||||||
btMechanik2.Turn( MoverParameters->ActiveCab < 0 );
|
btMechanik2.Turn( MoverParameters->ActiveCab < 0 );
|
||||||
@@ -2780,14 +2780,14 @@ bool TDynamicObject::Update(double dt, double dt1)
|
|||||||
if (Mechanik)
|
if (Mechanik)
|
||||||
{ // Ra 2F3F: do Driver.cpp to przenieść?
|
{ // Ra 2F3F: do Driver.cpp to przenieść?
|
||||||
MoverParameters->EqvtPipePress = GetEPP(); // srednie cisnienie w PG
|
MoverParameters->EqvtPipePress = GetEPP(); // srednie cisnienie w PG
|
||||||
if ((Mechanik->Primary())
|
if ((Mechanik->primary())
|
||||||
&& (MoverParameters->EngineType == TEngineType::DieselEngine)
|
&& (MoverParameters->EngineType == TEngineType::DieselEngine)
|
||||||
&& (MoverParameters->EIMCtrlType > 0)) {
|
&& (MoverParameters->EIMCtrlType > 0)) {
|
||||||
MoverParameters->CheckEIMIC(dt1);
|
MoverParameters->CheckEIMIC(dt1);
|
||||||
MoverParameters->eimic_real = MoverParameters->eimic;
|
MoverParameters->eimic_real = MoverParameters->eimic;
|
||||||
MoverParameters->SendCtrlToNext("EIMIC", MoverParameters->eimic, MoverParameters->CabNo);
|
MoverParameters->SendCtrlToNext("EIMIC", MoverParameters->eimic, MoverParameters->CabNo);
|
||||||
}
|
}
|
||||||
if( ( Mechanik->Primary() )
|
if( ( Mechanik->primary() )
|
||||||
&& ( MoverParameters->EngineType == TEngineType::ElectricInductionMotor ) ) {
|
&& ( MoverParameters->EngineType == TEngineType::ElectricInductionMotor ) ) {
|
||||||
// jesli glowny i z asynchronami, to niech steruje hamulcem i napedem lacznie dla calego pociagu/ezt
|
// jesli glowny i z asynchronami, to niech steruje hamulcem i napedem lacznie dla calego pociagu/ezt
|
||||||
auto const kier = (DirectionGet() * MoverParameters->ActiveCab > 0);
|
auto const kier = (DirectionGet() * MoverParameters->ActiveCab > 0);
|
||||||
|
|||||||
@@ -897,7 +897,7 @@ whois_event::run_() {
|
|||||||
// jeśli typ pojazdu
|
// jeśli typ pojazdu
|
||||||
// TODO: define and recognize individual request types
|
// TODO: define and recognize individual request types
|
||||||
auto const owner { (
|
auto const owner { (
|
||||||
( ( m_activator->Mechanik != nullptr ) && ( m_activator->Mechanik->Primary() ) ) ?
|
( ( m_activator->Mechanik != nullptr ) && ( m_activator->Mechanik->primary() ) ) ?
|
||||||
m_activator->Mechanik :
|
m_activator->Mechanik :
|
||||||
m_activator->ctOwner ) };
|
m_activator->ctOwner ) };
|
||||||
auto const consistbrakelevel { (
|
auto const consistbrakelevel { (
|
||||||
@@ -952,7 +952,7 @@ whois_event::run_() {
|
|||||||
}
|
}
|
||||||
// +0
|
// +0
|
||||||
else if( m_activator->Mechanik ) {
|
else if( m_activator->Mechanik ) {
|
||||||
if( m_activator->Mechanik->Primary() ) { // tylko jeśli ktoś tam siedzi - nie powinno dotyczyć pasażera!
|
if( m_activator->Mechanik->primary() ) { // tylko jeśli ktoś tam siedzi - nie powinno dotyczyć pasażera!
|
||||||
targetcell->UpdateValues(
|
targetcell->UpdateValues(
|
||||||
m_activator->Mechanik->TrainName(),
|
m_activator->Mechanik->TrainName(),
|
||||||
m_activator->Mechanik->StationCount() - m_activator->Mechanik->StationIndex(), // ile przystanków do końca
|
m_activator->Mechanik->StationCount() - m_activator->Mechanik->StationIndex(), // ile przystanków do końca
|
||||||
|
|||||||
@@ -974,6 +974,7 @@ public:
|
|||||||
TBrakePressureTable BrakePressureTable; /*wyszczegolnienie cisnien w rurze*/
|
TBrakePressureTable BrakePressureTable; /*wyszczegolnienie cisnien w rurze*/
|
||||||
TBrakePressure BrakePressureActual; //wartości ważone dla aktualnej pozycji kranu
|
TBrakePressure BrakePressureActual; //wartości ważone dla aktualnej pozycji kranu
|
||||||
int ASBType = 0; /*0: brak hamulca przeciwposlizgowego, 1: reczny, 2: automat*/
|
int ASBType = 0; /*0: brak hamulca przeciwposlizgowego, 1: reczny, 2: automat*/
|
||||||
|
int UniversalBrakeButtonFlag[3] = { 0, 0, 0 }; /* mozliwe działania przycisków hamulcowych */
|
||||||
int TurboTest = 0;
|
int TurboTest = 0;
|
||||||
double MaxBrakeForce = 0.0; /*maksymalna sila nacisku hamulca*/
|
double MaxBrakeForce = 0.0; /*maksymalna sila nacisku hamulca*/
|
||||||
double MaxBrakePress[5]; //pomocniczy, proz, sred, lad, pp
|
double MaxBrakePress[5]; //pomocniczy, proz, sred, lad, pp
|
||||||
@@ -1016,6 +1017,9 @@ public:
|
|||||||
double EmergencyValveOff = 0.0;
|
double EmergencyValveOff = 0.0;
|
||||||
bool EmergencyValveOpen = false;
|
bool EmergencyValveOpen = false;
|
||||||
double EmergencyValveArea = 0.0;
|
double EmergencyValveArea = 0.0;
|
||||||
|
double LockPipeOn = -1.0;
|
||||||
|
double LockPipeOff = -1.0;
|
||||||
|
double HandleUnlock = -3.0;
|
||||||
int CompressorListPosNo = 0;
|
int CompressorListPosNo = 0;
|
||||||
int CompressorListDefPos = 1;
|
int CompressorListDefPos = 1;
|
||||||
bool CompressorListWrap = false;
|
bool CompressorListWrap = false;
|
||||||
@@ -1228,6 +1232,9 @@ public:
|
|||||||
double UnitBrakeForce = 0.0; /*!s siła hamowania przypadająca na jeden element*/
|
double UnitBrakeForce = 0.0; /*!s siła hamowania przypadająca na jeden element*/
|
||||||
double Ntotal = 0.0; /*!s siła nacisku klockow*/
|
double Ntotal = 0.0; /*!s siła nacisku klockow*/
|
||||||
bool SlippingWheels = false; bool SandDose = false; /*! poslizg kol, sypanie piasku*/
|
bool SlippingWheels = false; bool SandDose = false; /*! poslizg kol, sypanie piasku*/
|
||||||
|
bool SandDoseManual = false; /*piaskowanie reczne*/
|
||||||
|
bool SandDoseAuto = false; /*piaskowanie automatyczne*/
|
||||||
|
bool SandDoseAutoAllow = true; /*zezwolenie na automatyczne piaskowanie*/
|
||||||
double Sand = 0.0; /*ilosc piasku*/
|
double Sand = 0.0; /*ilosc piasku*/
|
||||||
double BrakeSlippingTimer = 0.0; /*pomocnicza zmienna do wylaczania przeciwposlizgu*/
|
double BrakeSlippingTimer = 0.0; /*pomocnicza zmienna do wylaczania przeciwposlizgu*/
|
||||||
double dpBrake = 0.0; double dpPipe = 0.0; double dpMainValve = 0.0; double dpLocalValve = 0.0;
|
double dpBrake = 0.0; double dpPipe = 0.0; double dpMainValve = 0.0; double dpLocalValve = 0.0;
|
||||||
@@ -1271,11 +1278,14 @@ public:
|
|||||||
int ManualBrakePos = 0; /*nastawa hamulca recznego*/
|
int ManualBrakePos = 0; /*nastawa hamulca recznego*/
|
||||||
double LocalBrakePosA = 0.0; /*nastawa hamulca pomocniczego*/
|
double LocalBrakePosA = 0.0; /*nastawa hamulca pomocniczego*/
|
||||||
double LocalBrakePosAEIM = 0.0; /*pozycja hamulca pomocniczego ep dla asynchronicznych ezt*/
|
double LocalBrakePosAEIM = 0.0; /*pozycja hamulca pomocniczego ep dla asynchronicznych ezt*/
|
||||||
|
bool UniversalBrakeButtonActive[3] = { false, false, false }; /* brake button pressed */
|
||||||
/*
|
/*
|
||||||
int BrakeStatus = b_off; //0 - odham, 1 - ham., 2 - uszk., 4 - odluzniacz, 8 - antyposlizg, 16 - uzyte EP, 32 - pozycja R, 64 - powrot z R
|
int BrakeStatus = b_off; //0 - odham, 1 - ham., 2 - uszk., 4 - odluzniacz, 8 - antyposlizg, 16 - uzyte EP, 32 - pozycja R, 64 - powrot z R
|
||||||
*/
|
*/
|
||||||
bool AlarmChainFlag = false; // manual emergency brake
|
bool AlarmChainFlag = false; // manual emergency brake
|
||||||
bool RadioStopFlag = false; /*hamowanie nagle*/
|
bool RadioStopFlag = false; /*hamowanie nagle*/
|
||||||
|
bool LockPipe = false; /*locking brake pipe in emergency state*/
|
||||||
|
bool UnlockPipe = false; /*unlockig brake pipe button pressed*/
|
||||||
int BrakeDelayFlag = 0; /*nastawa opoznienia ham. osob/towar/posp/exp 0/1/2/4*/
|
int BrakeDelayFlag = 0; /*nastawa opoznienia ham. osob/towar/posp/exp 0/1/2/4*/
|
||||||
int BrakeDelays = 0; /*nastawy mozliwe do uzyskania*/
|
int BrakeDelays = 0; /*nastawy mozliwe do uzyskania*/
|
||||||
int BrakeOpModeFlag = 0; /*nastawa trybu pracy PS/PN/EP/MED 1/2/4/8*/
|
int BrakeOpModeFlag = 0; /*nastawa trybu pracy PS/PN/EP/MED 1/2/4/8*/
|
||||||
@@ -1520,7 +1530,10 @@ public:
|
|||||||
|
|
||||||
bool AddPulseForce(int Multipler);/*dla drezyny*/
|
bool AddPulseForce(int Multipler);/*dla drezyny*/
|
||||||
|
|
||||||
|
bool SandboxManual( bool const State, range_t const Notify = range_t::consist );/*wlacza/wylacza reczne sypanie piasku*/
|
||||||
|
bool SandboxAuto( bool const State, range_t const Notify = range_t::consist );/*wlacza/wylacza automatyczne sypanie piasku*/
|
||||||
bool Sandbox( bool const State, range_t const Notify = range_t::consist );/*wlacza/wylacza sypanie piasku*/
|
bool Sandbox( bool const State, range_t const Notify = range_t::consist );/*wlacza/wylacza sypanie piasku*/
|
||||||
|
bool SandboxAutoAllow(bool const State);/*wlacza/wylacza zezwolenie na automatyczne sypanie piasku*/
|
||||||
|
|
||||||
/*! zbijanie czuwaka/SHP*/
|
/*! zbijanie czuwaka/SHP*/
|
||||||
void SecuritySystemReset(void);
|
void SecuritySystemReset(void);
|
||||||
@@ -1545,6 +1558,7 @@ public:
|
|||||||
bool AlarmChainSwitch( bool const State );
|
bool AlarmChainSwitch( bool const State );
|
||||||
bool AntiSlippingBrake(void);
|
bool AntiSlippingBrake(void);
|
||||||
bool BrakeReleaser(int state);
|
bool BrakeReleaser(int state);
|
||||||
|
bool UniversalBrakeButton(int button, int state); /*uniwersalny przycisk hamulca*/
|
||||||
bool SwitchEPBrake(int state);
|
bool SwitchEPBrake(int state);
|
||||||
bool AntiSlippingButton(void); /*! reczny wlacznik urzadzen antyposlizgowych*/
|
bool AntiSlippingButton(void); /*! reczny wlacznik urzadzen antyposlizgowych*/
|
||||||
|
|
||||||
|
|||||||
@@ -1199,12 +1199,12 @@ void TMoverParameters::CollisionDetect(int const End, double const dt)
|
|||||||
|
|
||||||
void
|
void
|
||||||
TMoverParameters::damage_coupler( int const End ) {
|
TMoverParameters::damage_coupler( int const End ) {
|
||||||
if( SetFlag( DamageFlag, dtrain_coupling ) )
|
auto &coupler{ Couplers[ End ] };
|
||||||
EventFlag = true;
|
|
||||||
|
|
||||||
auto &coupler { Couplers[ End ] };
|
if( SetFlag( DamageFlag, dtrain_coupling ) )
|
||||||
|
EventFlag = true;
|
||||||
|
|
||||||
if( ( coupler.CouplingFlag & ctrain_pneumatic ) == ctrain_pneumatic ) {
|
if( ( coupler.CouplingFlag & coupling::brakehose ) == coupling::brakehose ) {
|
||||||
// hamowanie nagle - zerwanie przewodow hamulcowych
|
// hamowanie nagle - zerwanie przewodow hamulcowych
|
||||||
AlarmChainFlag = true;
|
AlarmChainFlag = true;
|
||||||
}
|
}
|
||||||
@@ -1215,11 +1215,11 @@ TMoverParameters::damage_coupler( int const End ) {
|
|||||||
switch( End ) {
|
switch( End ) {
|
||||||
// break connection with other vehicle, if there's any
|
// break connection with other vehicle, if there's any
|
||||||
case 0: {
|
case 0: {
|
||||||
coupler.Connected->Couplers[ end::rear ].CouplingFlag = 0;
|
coupler.Connected->Couplers[ end::rear ].CouplingFlag = coupling::faux;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: {
|
case 1: {
|
||||||
coupler.Connected->Couplers[ end::front ].CouplingFlag = 0;
|
coupler.Connected->Couplers[ end::front ].CouplingFlag = coupling::faux;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@@ -2462,6 +2462,63 @@ bool TMoverParameters::AddPulseForce(int Multipler)
|
|||||||
return APF;
|
return APF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// *************************************************************************************************
|
||||||
|
// yB: 20190909
|
||||||
|
// sypanie piasku reczne
|
||||||
|
// *************************************************************************************************
|
||||||
|
bool TMoverParameters::SandboxManual(bool const State, range_t const Notify)
|
||||||
|
{
|
||||||
|
bool result{ false };
|
||||||
|
|
||||||
|
if (SandDoseManual != State) {
|
||||||
|
if (SandDoseManual == false) {
|
||||||
|
// switch on
|
||||||
|
if (Sand > 0) {
|
||||||
|
SandDoseManual = true;
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// switch off
|
||||||
|
SandDoseManual = false;
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Sandbox(SandDoseManual || SandDoseAuto, Notify);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// *************************************************************************************************
|
||||||
|
// yB: 20190909
|
||||||
|
// sypanie piasku automatyczne
|
||||||
|
// *************************************************************************************************
|
||||||
|
bool TMoverParameters::SandboxAuto(bool const State, range_t const Notify)
|
||||||
|
{
|
||||||
|
bool result{ false };
|
||||||
|
bool NewState = State && SandDoseAutoAllow;
|
||||||
|
if (SandDoseAuto != NewState) {
|
||||||
|
if (SandDoseAuto == false) {
|
||||||
|
// switch on
|
||||||
|
if (Sand > 0) {
|
||||||
|
SandDoseAuto = true;
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// switch off
|
||||||
|
SandDoseAuto = false;
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Sandbox(SandDoseManual || SandDoseAuto, Notify);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
// Q: 20160713
|
// Q: 20160713
|
||||||
// sypanie piasku
|
// sypanie piasku
|
||||||
@@ -2505,6 +2562,24 @@ bool TMoverParameters::Sandbox( bool const State, range_t const Notify )
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// *************************************************************************************************
|
||||||
|
// yB: 20190909
|
||||||
|
// włączenie / wyłączenie automatycznej piasecznicy
|
||||||
|
// *************************************************************************************************
|
||||||
|
bool TMoverParameters::SandboxAutoAllow(bool State)
|
||||||
|
{
|
||||||
|
//SendCtrlToNext("SandboxAutoAllow", int(State), CabNo, ctrain_controll);
|
||||||
|
|
||||||
|
if (SandDoseAutoAllow != State)
|
||||||
|
{
|
||||||
|
SandDoseAutoAllow = State;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// *****************************************************************************
|
// *****************************************************************************
|
||||||
// Q: 20160710
|
// Q: 20160710
|
||||||
// zbicie czuwaka / SHP
|
// zbicie czuwaka / SHP
|
||||||
@@ -3357,6 +3432,37 @@ bool TMoverParameters::BrakeReleaser(int state)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// *************************************************************************************************
|
||||||
|
// yB: 20160711
|
||||||
|
// włączenie / wyłączenie uniwersalnego przycisku hamulcowego
|
||||||
|
// *************************************************************************************************
|
||||||
|
bool TMoverParameters::UniversalBrakeButton(int button, int state)
|
||||||
|
{
|
||||||
|
bool OK = true; //false tylko jeśli nie uda się wysłać, GF 20161124
|
||||||
|
UniversalBrakeButtonActive[button] = state > 0;
|
||||||
|
int flag = 0;
|
||||||
|
if (Battery) {
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
flag = flag | (UniversalBrakeButtonActive[i] ? UniversalBrakeButtonFlag[i] : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Hamulec->SetUniversalFlag(flag);
|
||||||
|
Handle->SetUniversalFlag(flag);
|
||||||
|
LocHandle->SetUniversalFlag(flag);
|
||||||
|
UnlockPipe = (flag & TUniversalBrake::ub_UnlockPipe) > 0;
|
||||||
|
|
||||||
|
//if the releaser can be activated by switch
|
||||||
|
if ( TestFlag ( UniversalBrakeButtonFlag[0] & UniversalBrakeButtonFlag[1] & UniversalBrakeButtonFlag[2],
|
||||||
|
TUniversalBrake::ub_Release ) )
|
||||||
|
{
|
||||||
|
Hamulec->Releaser( int ( TestFlag ( flag, TUniversalBrake::ub_Release ) ));
|
||||||
|
if (CabNo != 0) // rekurencyjne wysłanie do następnego
|
||||||
|
OK = SendCtrlToNext("BrakeReleaser", state, CabNo);
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
// Q: 20160711
|
// Q: 20160711
|
||||||
// włączenie / wyłączenie hamulca elektro-pneumatycznego
|
// włączenie / wyłączenie hamulca elektro-pneumatycznego
|
||||||
@@ -3815,11 +3921,17 @@ void TMoverParameters::UpdatePipePressure(double dt)
|
|||||||
dpLocalValve = LocHandle->GetPF(std::max(LocalBrakePosA, LocalBrakePosAEIM), Hamulec->GetBCP(), ScndPipePress, dt, 0);
|
dpLocalValve = LocHandle->GetPF(std::max(LocalBrakePosA, LocalBrakePosAEIM), Hamulec->GetBCP(), ScndPipePress, dt, 0);
|
||||||
else
|
else
|
||||||
dpLocalValve = LocHandle->GetPF(LocalBrakePosAEIM, Hamulec->GetBCP(), ScndPipePress, dt, 0);
|
dpLocalValve = LocHandle->GetPF(LocalBrakePosAEIM, Hamulec->GetBCP(), ScndPipePress, dt, 0);
|
||||||
if( ( BrakeHandle == TBrakeHandle::FV4a )
|
|
||||||
&& ( ( PipePress < 2.75 )
|
LockPipe = PipePress < (LockPipe ? LockPipeOff : LockPipeOn);
|
||||||
&& ( ( Hamulec->GetStatus() & b_rls ) == 0 ) )
|
bool lock_new = (LockPipe && !UnlockPipe && (BrakeCtrlPosR > HandleUnlock)); //new simple codition based on .fiz
|
||||||
&& ( BrakeSubsystem == TBrakeSubSystem::ss_LSt )
|
bool lock_old = ((BrakeHandle == TBrakeHandle::FV4a) //old complex condition based on assumptions
|
||||||
&& ( TrainType != dt_EZT ) ) {
|
&& ((PipePress < 2.75)
|
||||||
|
&& ((Hamulec->GetStatus() & b_rls) == 0))
|
||||||
|
&& (BrakeSubsystem == TBrakeSubSystem::ss_LSt)
|
||||||
|
&& (TrainType != dt_EZT)
|
||||||
|
&& (!UnlockPipe));
|
||||||
|
|
||||||
|
if( ( lock_old ) || ( lock_new ) ) {
|
||||||
temp = PipePress + 0.00001;
|
temp = PipePress + 0.00001;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -5517,11 +5629,11 @@ double TMoverParameters::TractionForce( double dt ) {
|
|||||||
if( ( SlippingWheels ) ) {
|
if( ( SlippingWheels ) ) {
|
||||||
PosRatio = 0;
|
PosRatio = 0;
|
||||||
tmp = 10;
|
tmp = 10;
|
||||||
Sandbox( true, range_t::unit );
|
SandboxAuto( true, range_t::unit );
|
||||||
} // przeciwposlizg
|
} // przeciwposlizg
|
||||||
else {
|
else {
|
||||||
// switch sandbox off
|
// switch sandbox off
|
||||||
Sandbox( false, range_t::unit );
|
SandboxAuto( false, range_t::unit );
|
||||||
}
|
}
|
||||||
|
|
||||||
eimv_pr += Max0R(Min0R(PosRatio - eimv_pr, 0.02), -0.02) * 12 *
|
eimv_pr += Max0R(Min0R(PosRatio - eimv_pr, 0.02), -0.02) * 12 *
|
||||||
@@ -8879,6 +8991,12 @@ void TMoverParameters::LoadFIZ_Brake( std::string const &line ) {
|
|||||||
extract_value( EmergencyValveOff, "MinEVP", line, "" );
|
extract_value( EmergencyValveOff, "MinEVP", line, "" );
|
||||||
extract_value( EmergencyValveOn, "MaxEVP", line, "" );
|
extract_value( EmergencyValveOn, "MaxEVP", line, "" );
|
||||||
extract_value( EmergencyValveArea, "EVArea", line, "" );
|
extract_value( EmergencyValveArea, "EVArea", line, "" );
|
||||||
|
extract_value( UniversalBrakeButtonFlag[0], "UBB1", line, "");
|
||||||
|
extract_value( UniversalBrakeButtonFlag[1], "UBB2", line, "");
|
||||||
|
extract_value( UniversalBrakeButtonFlag[2], "UBB3", line, "");
|
||||||
|
extract_value( LockPipeOn, "LPOn", line, "-1");
|
||||||
|
extract_value( LockPipeOff, "LPOff", line, "-1");
|
||||||
|
extract_value( HandleUnlock, "HandlePipeUnlockPos", line, "-3");
|
||||||
{
|
{
|
||||||
std::map<std::string, int> compressorpowers{
|
std::map<std::string, int> compressorpowers{
|
||||||
{ "Main", 0 },
|
{ "Main", 0 },
|
||||||
|
|||||||
@@ -1300,7 +1300,9 @@ double TLSt::GetPF( double const PP, double const dt, double const Vel )
|
|||||||
SoundFlag |= sf_CylU;
|
SoundFlag |= sf_CylU;
|
||||||
}
|
}
|
||||||
// equivalent of checkreleaser() in the base class?
|
// equivalent of checkreleaser() in the base class?
|
||||||
if( ( BrakeStatus & b_rls ) == b_rls ) {
|
bool is_releasing = ( ( BrakeStatus & b_rls)
|
||||||
|
|| ( UniversalFlag & TUniversalBrake::ub_Release ) );
|
||||||
|
if ( is_releasing ) {
|
||||||
if( CVP < 0.0 ) {
|
if( CVP < 0.0 ) {
|
||||||
BrakeStatus &= ~b_rls;
|
BrakeStatus &= ~b_rls;
|
||||||
}
|
}
|
||||||
@@ -1373,9 +1375,12 @@ double TLSt::GetPF( double const PP, double const dt, double const Vel )
|
|||||||
temp = 1 - RapidTemp;
|
temp = 1 - RapidTemp;
|
||||||
if (EDFlag > 0.2)
|
if (EDFlag > 0.2)
|
||||||
temp = 10000;
|
temp = 10000;
|
||||||
|
double tempasb = 0;
|
||||||
|
if ( ( (UniversalFlag & TUniversalBrake::ub_AntiSlipBrake) > 0)
|
||||||
|
|| ( (BrakeStatus & b_asb_unbrake) == b_asb_unbrake ) )
|
||||||
|
tempasb = ASBP;
|
||||||
// powtarzacz — podwojny zawor zwrotny
|
// powtarzacz — podwojny zawor zwrotny
|
||||||
temp = Max0R(((CVP - BCP) * BVM + ASBP * int((BrakeStatus & b_asb_unbrake) == b_asb_unbrake)) / temp, LBP);
|
temp = Max0R( ( (CVP - BCP) * BVM + tempasb ) / temp, LBP );
|
||||||
// luzowanie CH
|
// luzowanie CH
|
||||||
if ((BrakeCyl->P() > temp + 0.005) || (temp < 0.28))
|
if ((BrakeCyl->P() > temp + 0.005) || (temp < 0.28))
|
||||||
// dV:=PF(0,BrakeCyl->P(),0.0015*3*sizeBC)*dt
|
// dV:=PF(0,BrakeCyl->P(),0.0015*3*sizeBC)*dt
|
||||||
@@ -1556,6 +1561,10 @@ double TEStED::GetPF( double const PP, double const dt, double const Vel )
|
|||||||
|
|
||||||
// powtarzacz — podwojny zawor zwrotny
|
// powtarzacz — podwojny zawor zwrotny
|
||||||
temp = Max0R(LoadC * BCP / temp * Min0R(Max0R(1 - EDFlag, 0), 1), LBP);
|
temp = Max0R(LoadC * BCP / temp * Min0R(Max0R(1 - EDFlag, 0), 1), LBP);
|
||||||
|
|
||||||
|
if ( ( UniversalFlag & TUniversalBrake::ub_AntiSlipBrake ) > 0 )
|
||||||
|
temp = std::max(temp, ASBP);
|
||||||
|
|
||||||
double speed = 1;
|
double speed = 1;
|
||||||
if ((ASBP < 0.1) && ((BrakeStatus & b_asb_unbrake) == b_asb_unbrake))
|
if ((ASBP < 0.1) && ((BrakeStatus & b_asb_unbrake) == b_asb_unbrake))
|
||||||
{
|
{
|
||||||
@@ -2292,6 +2301,11 @@ void TDriverHandle::OvrldButton(bool Active)
|
|||||||
{
|
{
|
||||||
ManualOvrldActive = Active;
|
ManualOvrldActive = Active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TDriverHandle::SetUniversalFlag(int flag)
|
||||||
|
{
|
||||||
|
UniversalFlag = flag;
|
||||||
|
}
|
||||||
//---FV4a---
|
//---FV4a---
|
||||||
|
|
||||||
double TFV4a::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
double TFV4a::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
||||||
@@ -2576,7 +2590,7 @@ double TMHZ_EN57::GetPF( double i_bcp, double PP, double HP, double dt, double e
|
|||||||
|
|
||||||
i_bcp = Max0R(Min0R(i_bcp, 9.999), -0.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
|
i_bcp = Max0R(Min0R(i_bcp, 9.999), -0.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
|
||||||
|
|
||||||
if ((TP > 0))
|
if ((TP > 0)&&(CP > 4.9))
|
||||||
{
|
{
|
||||||
DP = 0.045;
|
DP = 0.045;
|
||||||
if (EQ(i_bcp, 0))
|
if (EQ(i_bcp, 0))
|
||||||
@@ -2591,8 +2605,13 @@ double TMHZ_EN57::GetPF( double i_bcp, double PP, double HP, double dt, double e
|
|||||||
LimPP = Min0R(LPP_RP(i_bcp) + TP * 0.08 + RedAdj, HP); // pozycja + czasowy lub zasilanie
|
LimPP = Min0R(LPP_RP(i_bcp) + TP * 0.08 + RedAdj, HP); // pozycja + czasowy lub zasilanie
|
||||||
ActFlowSpeed = 4;
|
ActFlowSpeed = 4;
|
||||||
|
|
||||||
if ((EQ(i_bcp, -1)))
|
double uop = UnbrakeOverPressure; //unbrake over pressure in actual state
|
||||||
pom = Min0R(HP, 5.4 + RedAdj);
|
ManualOvrldActive = (UniversalFlag & TUniversalBrake::ub_HighPressure); //button is pressed
|
||||||
|
if (ManualOvrld && !ManualOvrldActive) //no overpressure for not pressed button if it does not exists
|
||||||
|
uop = 0;
|
||||||
|
|
||||||
|
if ( ( EQ( i_bcp, -1 ) ) && ( uop > 0 ) )
|
||||||
|
pom = Min0R(HP, 5.4 + RedAdj + uop);
|
||||||
else
|
else
|
||||||
pom = Min0R(CP, HP);
|
pom = Min0R(CP, HP);
|
||||||
|
|
||||||
@@ -2602,9 +2621,9 @@ double TMHZ_EN57::GetPF( double i_bcp, double PP, double HP, double dt, double e
|
|||||||
CP = CP + 13 * Min0R(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt; // zbiornik sterujacy
|
CP = CP + 13 * Min0R(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt; // zbiornik sterujacy
|
||||||
|
|
||||||
LimPP = pom; // cp
|
LimPP = pom; // cp
|
||||||
if (EQ(i_bcp, -1))
|
//if (EQ(i_bcp, -1))
|
||||||
dpPipe = HP;
|
// dpPipe = HP;
|
||||||
else
|
// else
|
||||||
dpPipe = Min0R(HP, LimPP);
|
dpPipe = Min0R(HP, LimPP);
|
||||||
|
|
||||||
if (dpPipe > PP)
|
if (dpPipe > PP)
|
||||||
@@ -2612,7 +2631,8 @@ double TMHZ_EN57::GetPF( double i_bcp, double PP, double HP, double dt, double e
|
|||||||
else
|
else
|
||||||
dpMainValve = PFVd(PP, 0, ActFlowSpeed / LBDelay, dpPipe, 0.4);
|
dpMainValve = PFVd(PP, 0, ActFlowSpeed / LBDelay, dpPipe, 0.4);
|
||||||
|
|
||||||
if (EQ(i_bcp, -1))
|
if ( ( EQ(i_bcp, -1) && ( AutoOvrld ) )
|
||||||
|
||(i_bcp<0.5 && (UniversalFlag & TUniversalBrake::ub_Overload)))
|
||||||
{
|
{
|
||||||
if ((TP < 5))
|
if ((TP < 5))
|
||||||
TP = TP + dt; // 5/10
|
TP = TP + dt; // 5/10
|
||||||
@@ -2691,6 +2711,15 @@ double TMHZ_EN57::LPP_RP(double pos) // cisnienie z zaokraglonej pozycji;
|
|||||||
return 5.0;
|
return 5.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TMHZ_EN57::SetParams(bool AO, bool MO, double OverP, double)
|
||||||
|
{
|
||||||
|
AutoOvrld = AO;
|
||||||
|
ManualOvrld = MO;
|
||||||
|
UnbrakeOverPressure = std::max(0.0, OverP);
|
||||||
|
Fala = (OverP > 0.01);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
bool TMHZ_EN57::EQ(double pos, double i_pos)
|
bool TMHZ_EN57::EQ(double pos, double i_pos)
|
||||||
{
|
{
|
||||||
return (pos <= i_pos + 0.5) && (pos > i_pos - 0.5);
|
return (pos <= i_pos + 0.5) && (pos > i_pos - 0.5);
|
||||||
@@ -2716,7 +2745,7 @@ double TMHZ_K5P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
|||||||
|
|
||||||
i_bcp = Max0R(Min0R(i_bcp, 2.999), -0.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
|
i_bcp = Max0R(Min0R(i_bcp, 2.999), -0.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
|
||||||
|
|
||||||
if ((TP > 0))
|
if ((TP > 0)&&(CP>4.9))
|
||||||
{
|
{
|
||||||
DP = 0.004;
|
DP = 0.004;
|
||||||
TP = TP - DP * dt;
|
TP = TP - DP * dt;
|
||||||
@@ -2742,14 +2771,19 @@ double TMHZ_K5P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
|||||||
else
|
else
|
||||||
CP = CP + 9 * Min0R(abs(LimCP - CP), 0.05) * PR(CP, LimCP) * dt; // zbiornik sterujacy
|
CP = CP + 9 * Min0R(abs(LimCP - CP), 0.05) * PR(CP, LimCP) * dt; // zbiornik sterujacy
|
||||||
|
|
||||||
dpPipe = Min0R(HP, CP + TP + RedAdj);
|
double uop = UnbrakeOverPressure; //unbrake over pressure in actual state
|
||||||
|
ManualOvrldActive = (UniversalFlag & TUniversalBrake::ub_HighPressure); //button is pressed
|
||||||
|
if (ManualOvrld && !ManualOvrldActive) //no overpressure for not pressed button if it does not exists
|
||||||
|
uop = 0;
|
||||||
|
|
||||||
|
dpPipe = Min0R(HP, CP + TP + RedAdj);
|
||||||
|
|
||||||
if (dpPipe > PP)
|
if (dpPipe > PP)
|
||||||
dpMainValve = -PFVa(HP, PP, ActFlowSpeed / LBDelay, dpPipe, 0.4);
|
dpMainValve = -PFVa(HP, PP, ActFlowSpeed / LBDelay, dpPipe, 0.4);
|
||||||
else
|
else
|
||||||
dpMainValve = PFVd(PP, 0, ActFlowSpeed / LBDelay, dpPipe, 0.4);
|
dpMainValve = PFVd(PP, 0, ActFlowSpeed / LBDelay, dpPipe, 0.4);
|
||||||
|
|
||||||
if ((EQ(i_bcp, -1)&&(AutoOvrld))||(ManualOvrld && ManualOvrldActive))
|
if ((EQ(i_bcp, -1) && (AutoOvrld)) || ((i_bcp<0.5) && (UniversalFlag & TUniversalBrake::ub_Overload)))
|
||||||
{
|
{
|
||||||
if ((TP < 1))
|
if ((TP < 1))
|
||||||
TP = TP + 0.03 * dt;
|
TP = TP + 0.03 * dt;
|
||||||
@@ -2805,10 +2839,13 @@ double TMHZ_K5P::GetCP()
|
|||||||
return CP;
|
return CP;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMHZ_K5P::SetParams(bool AO, bool MO, double, double)
|
void TMHZ_K5P::SetParams(bool AO, bool MO, double OverP, double)
|
||||||
{
|
{
|
||||||
AutoOvrld = AO;
|
AutoOvrld = AO;
|
||||||
ManualOvrld = MO;
|
ManualOvrld = MO;
|
||||||
|
UnbrakeOverPressure = std::max(0.0, OverP);
|
||||||
|
Fala = (OverP > 0.01);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TMHZ_K5P::EQ(double pos, double i_pos)
|
bool TMHZ_K5P::EQ(double pos, double i_pos)
|
||||||
@@ -2836,7 +2873,7 @@ double TMHZ_6P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
|||||||
|
|
||||||
i_bcp = Max0R(Min0R(i_bcp, 3.999), -0.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
|
i_bcp = Max0R(Min0R(i_bcp, 3.999), -0.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
|
||||||
|
|
||||||
if ((TP > 0))
|
if ((TP > 0)&&(CP>4.9))
|
||||||
{
|
{
|
||||||
DP = 0.004;
|
DP = 0.004;
|
||||||
TP = TP - DP * dt;
|
TP = TP - DP * dt;
|
||||||
@@ -2864,9 +2901,14 @@ double TMHZ_6P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
|||||||
|
|
||||||
dpPipe = Min0R(HP, CP + TP + RedAdj);
|
dpPipe = Min0R(HP, CP + TP + RedAdj);
|
||||||
|
|
||||||
|
double uop = UnbrakeOverPressure; //unbrake over pressure in actual state
|
||||||
|
ManualOvrldActive = (UniversalFlag & TUniversalBrake::ub_HighPressure); //button is pressed
|
||||||
|
if (ManualOvrld && !ManualOvrldActive) //no overpressure for not pressed button if it does not exists
|
||||||
|
uop = 0;
|
||||||
|
|
||||||
if (Fala && EQ(i_bcp, -1))
|
if (Fala && EQ(i_bcp, -1))
|
||||||
{
|
{
|
||||||
dpPipe = 5.0 + TP + RedAdj + UnbrakeOverPressure;
|
dpPipe = 5.0 + TP + RedAdj + uop;
|
||||||
ActFlowSpeed = 12;
|
ActFlowSpeed = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2875,7 +2917,7 @@ double TMHZ_6P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
|||||||
else
|
else
|
||||||
dpMainValve = PFVd(PP, 0, ActFlowSpeed / LBDelay, dpPipe, 0.4);
|
dpMainValve = PFVd(PP, 0, ActFlowSpeed / LBDelay, dpPipe, 0.4);
|
||||||
|
|
||||||
if ((EQ(i_bcp, -1) && (AutoOvrld)) || (ManualOvrld && ManualOvrldActive))
|
if ((EQ(i_bcp, -1) && (AutoOvrld)) || ((i_bcp<0.5) && (UniversalFlag & TUniversalBrake::ub_Overload)))
|
||||||
{
|
{
|
||||||
if ((TP < 1))
|
if ((TP < 1))
|
||||||
TP = TP + 0.03 * dt;
|
TP = TP + 0.03 * dt;
|
||||||
|
|||||||
@@ -133,6 +133,16 @@ static double const BPT_394[7][2] = { {13 , 10.0} , {5 , 5.0} , {0 , -1} , {5 ,
|
|||||||
static int const i_bcpno = 6;
|
static int const i_bcpno = 6;
|
||||||
// static double const pi = 3.141592653589793; //definicja w mctools
|
// static double const pi = 3.141592653589793; //definicja w mctools
|
||||||
|
|
||||||
|
enum TUniversalBrake // możliwe działania uniwersalnego przycisku hamulca
|
||||||
|
{ // kolejne flagi
|
||||||
|
ub_Release = 0x01, // odluźniacz - ZR
|
||||||
|
ub_UnlockPipe = 0x02, // odblok PG / mostkowanie hamulca bezpieczeństwa - POJAZD
|
||||||
|
ub_HighPressure = 0x04, // impuls wysokiego ciśnienia - ZM
|
||||||
|
ub_Overload = 0x08, // przycisk asymilacji / kontrolowanego przeładowania - ZM
|
||||||
|
ub_AntiSlipBrake = 0x10, // przycisk przyhamowania przeciwposlizgowego - ZR
|
||||||
|
ub_Ostatni = 0x80000000 // ostatnia flaga bitowa
|
||||||
|
};
|
||||||
|
|
||||||
//klasa obejmujaca pojedyncze zbiorniki
|
//klasa obejmujaca pojedyncze zbiorniki
|
||||||
class TReservoir {
|
class TReservoir {
|
||||||
|
|
||||||
@@ -183,6 +193,7 @@ class TBrake {
|
|||||||
double SizeBC = 0.0; //rozmiar^2 CH (w stosunku do 14")
|
double SizeBC = 0.0; //rozmiar^2 CH (w stosunku do 14")
|
||||||
bool DCV = false; //podwojny zawor zwrotny
|
bool DCV = false; //podwojny zawor zwrotny
|
||||||
double ASBP = 0.0; //cisnienie hamulca pp
|
double ASBP = 0.0; //cisnienie hamulca pp
|
||||||
|
int UniversalFlag = 0; //flaga wcisnietych przyciskow uniwersalnych
|
||||||
|
|
||||||
int BrakeStatus{ b_off }; //flaga stanu
|
int BrakeStatus{ b_off }; //flaga stanu
|
||||||
int SoundFlag = 0;
|
int SoundFlag = 0;
|
||||||
@@ -220,6 +231,7 @@ class TBrake {
|
|||||||
int GetBrakeStatus() const { return BrakeStatus; }
|
int GetBrakeStatus() const { return BrakeStatus; }
|
||||||
void SetBrakeStatus( int const Status ) { BrakeStatus = Status; }
|
void SetBrakeStatus( int const Status ) { BrakeStatus = Status; }
|
||||||
virtual void SetED( double const EDstate ) {}; //stan hamulca ED do luzowania
|
virtual void SetED( double const EDstate ) {}; //stan hamulca ED do luzowania
|
||||||
|
virtual void SetUniversalFlag(int flag) { UniversalFlag = flag; } //przycisk uniwersalny
|
||||||
};
|
};
|
||||||
|
|
||||||
class TWest : public TBrake {
|
class TWest : public TBrake {
|
||||||
@@ -520,6 +532,7 @@ class TDriverHandle {
|
|||||||
bool AutoOvrld = false; //czy jest asymilacja automatyczna na pozycji -1
|
bool AutoOvrld = false; //czy jest asymilacja automatyczna na pozycji -1
|
||||||
bool ManualOvrld = false; //czy jest asymilacja reczna przyciskiem
|
bool ManualOvrld = false; //czy jest asymilacja reczna przyciskiem
|
||||||
bool ManualOvrldActive = false; //czy jest wcisniety przycisk asymilacji
|
bool ManualOvrldActive = false; //czy jest wcisniety przycisk asymilacji
|
||||||
|
int UniversalFlag = 0; //flaga wcisnietych przyciskow uniwersalnych
|
||||||
public:
|
public:
|
||||||
bool Time = false;
|
bool Time = false;
|
||||||
bool TimeEP = false;
|
bool TimeEP = false;
|
||||||
@@ -534,7 +547,7 @@ class TDriverHandle {
|
|||||||
virtual double GetEP(double pos); //pobranie sily hamulca ep
|
virtual double GetEP(double pos); //pobranie sily hamulca ep
|
||||||
virtual void SetParams(bool AO, bool MO, double, double) {}; //ustawianie jakichs parametrów dla zaworu
|
virtual void SetParams(bool AO, bool MO, double, double) {}; //ustawianie jakichs parametrów dla zaworu
|
||||||
virtual void OvrldButton(bool Active); //przycisk recznego przeladowania/asymilacji
|
virtual void OvrldButton(bool Active); //przycisk recznego przeladowania/asymilacji
|
||||||
|
virtual void SetUniversalFlag(int flag); //przycisk uniwersalny
|
||||||
inline TDriverHandle() { memset( Sounds, 0, sizeof( Sounds ) ); }
|
inline TDriverHandle() { memset( Sounds, 0, sizeof( Sounds ) ); }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -589,6 +602,7 @@ class TMHZ_EN57 : public TDriverHandle {
|
|||||||
double RP = 0.0; //zbiornik redukcyjny
|
double RP = 0.0; //zbiornik redukcyjny
|
||||||
double RedAdj = 0.0; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
|
double RedAdj = 0.0; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
|
||||||
bool Fala = false;
|
bool Fala = false;
|
||||||
|
double UnbrakeOverPressure = 0.0;
|
||||||
static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 };
|
static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 };
|
||||||
|
|
||||||
double LPP_RP(double pos);
|
double LPP_RP(double pos);
|
||||||
@@ -602,7 +616,7 @@ class TMHZ_EN57 : public TDriverHandle {
|
|||||||
double GetPos(int i)/*override*/;
|
double GetPos(int i)/*override*/;
|
||||||
double GetCP()/*override*/;
|
double GetCP()/*override*/;
|
||||||
double GetEP(double pos);
|
double GetEP(double pos);
|
||||||
|
void SetParams(bool AO, bool MO, double OverP, double);
|
||||||
inline TMHZ_EN57(void) :
|
inline TMHZ_EN57(void) :
|
||||||
TDriverHandle()
|
TDriverHandle()
|
||||||
{}
|
{}
|
||||||
@@ -616,6 +630,7 @@ private:
|
|||||||
double RP = 0.0; //zbiornik redukcyjny
|
double RP = 0.0; //zbiornik redukcyjny
|
||||||
double RedAdj = 0.0; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
|
double RedAdj = 0.0; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
|
||||||
bool Fala = false; //czy jest napelnianie uderzeniowe
|
bool Fala = false; //czy jest napelnianie uderzeniowe
|
||||||
|
double UnbrakeOverPressure = 0.0;
|
||||||
static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 };
|
static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 };
|
||||||
|
|
||||||
bool EQ(double pos, double i_pos);
|
bool EQ(double pos, double i_pos);
|
||||||
|
|||||||
147
Train.cpp
147
Train.cpp
@@ -180,6 +180,9 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
|
|||||||
{ user_command::independentbrakedecreasefast, &TTrain::OnCommand_independentbrakedecreasefast },
|
{ user_command::independentbrakedecreasefast, &TTrain::OnCommand_independentbrakedecreasefast },
|
||||||
{ user_command::independentbrakeset, &TTrain::OnCommand_independentbrakeset },
|
{ user_command::independentbrakeset, &TTrain::OnCommand_independentbrakeset },
|
||||||
{ user_command::independentbrakebailoff, &TTrain::OnCommand_independentbrakebailoff },
|
{ user_command::independentbrakebailoff, &TTrain::OnCommand_independentbrakebailoff },
|
||||||
|
{ user_command::universalbrakebutton1, &TTrain::OnCommand_universalbrakebutton1 },
|
||||||
|
{ user_command::universalbrakebutton2, &TTrain::OnCommand_universalbrakebutton2 },
|
||||||
|
{ user_command::universalbrakebutton3, &TTrain::OnCommand_universalbrakebutton3 },
|
||||||
{ user_command::trainbrakeincrease, &TTrain::OnCommand_trainbrakeincrease },
|
{ user_command::trainbrakeincrease, &TTrain::OnCommand_trainbrakeincrease },
|
||||||
{ user_command::trainbrakedecrease, &TTrain::OnCommand_trainbrakedecrease },
|
{ user_command::trainbrakedecrease, &TTrain::OnCommand_trainbrakedecrease },
|
||||||
{ user_command::trainbrakeset, &TTrain::OnCommand_trainbrakeset },
|
{ user_command::trainbrakeset, &TTrain::OnCommand_trainbrakeset },
|
||||||
@@ -476,6 +479,8 @@ dictionary_source *TTrain::GetTrainState() {
|
|||||||
dict->insert( "converter", mvControlled->ConverterFlag );
|
dict->insert( "converter", mvControlled->ConverterFlag );
|
||||||
dict->insert( "converter_overload", mvControlled->ConvOvldFlag );
|
dict->insert( "converter_overload", mvControlled->ConvOvldFlag );
|
||||||
dict->insert( "compress", mvControlled->CompressorFlag );
|
dict->insert( "compress", mvControlled->CompressorFlag );
|
||||||
|
dict->insert( "lights_front", mvOccupied->iLights[ end::front ] );
|
||||||
|
dict->insert( "lights_rear", mvOccupied->iLights[ end::rear ] );
|
||||||
// reverser
|
// reverser
|
||||||
dict->insert( "direction", mover->ActiveDir );
|
dict->insert( "direction", mover->ActiveDir );
|
||||||
// throttle
|
// throttle
|
||||||
@@ -1175,6 +1180,60 @@ void TTrain::OnCommand_independentbrakebailoff( TTrain *Train, command_data cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TTrain::OnCommand_universalbrakebutton1(TTrain *Train, command_data const &Command) {
|
||||||
|
|
||||||
|
if (Command.action == GLFW_PRESS) {
|
||||||
|
// press or hold
|
||||||
|
// visual feedback
|
||||||
|
Train->ggUniveralBrakeButton1.UpdateValue(1.0, Train->dsbSwitch);
|
||||||
|
|
||||||
|
Train->mvOccupied->UniversalBrakeButton(0,1);
|
||||||
|
}
|
||||||
|
else if (Command.action == GLFW_RELEASE) {
|
||||||
|
// release
|
||||||
|
// visual feedback
|
||||||
|
Train->ggUniveralBrakeButton1.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
|
|
||||||
|
Train->mvOccupied->UniversalBrakeButton(0,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TTrain::OnCommand_universalbrakebutton2(TTrain *Train, command_data const &Command) {
|
||||||
|
|
||||||
|
if (Command.action == GLFW_PRESS) {
|
||||||
|
// press or hold
|
||||||
|
// visual feedback
|
||||||
|
Train->ggUniveralBrakeButton2.UpdateValue(1.0, Train->dsbSwitch);
|
||||||
|
|
||||||
|
Train->mvOccupied->UniversalBrakeButton(1, 1);
|
||||||
|
}
|
||||||
|
else if (Command.action == GLFW_RELEASE) {
|
||||||
|
// release
|
||||||
|
// visual feedback
|
||||||
|
Train->ggUniveralBrakeButton2.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
|
|
||||||
|
Train->mvOccupied->UniversalBrakeButton(1, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TTrain::OnCommand_universalbrakebutton3(TTrain *Train, command_data const &Command) {
|
||||||
|
|
||||||
|
if (Command.action == GLFW_PRESS) {
|
||||||
|
// press or hold
|
||||||
|
// visual feedback
|
||||||
|
Train->ggUniveralBrakeButton3.UpdateValue(1.0, Train->dsbSwitch);
|
||||||
|
|
||||||
|
Train->mvOccupied->UniversalBrakeButton(2, 1);
|
||||||
|
}
|
||||||
|
else if (Command.action == GLFW_RELEASE) {
|
||||||
|
// release
|
||||||
|
// visual feedback
|
||||||
|
Train->ggUniveralBrakeButton3.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
|
|
||||||
|
Train->mvOccupied->UniversalBrakeButton(2, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TTrain::OnCommand_trainbrakeincrease( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_trainbrakeincrease( TTrain *Train, command_data const &Command ) {
|
||||||
if (Command.action == GLFW_REPEAT && Train->mvOccupied->BrakeHandle == TBrakeHandle::FV4a)
|
if (Command.action == GLFW_REPEAT && Train->mvOccupied->BrakeHandle == TBrakeHandle::FV4a)
|
||||||
Train->mvOccupied->BrakeLevelAdd( Global.brake_speed * Command.time_delta * Train->mvOccupied->BrakeCtrlPosNo );
|
Train->mvOccupied->BrakeLevelAdd( Global.brake_speed * Command.time_delta * Train->mvOccupied->BrakeCtrlPosNo );
|
||||||
@@ -1439,16 +1498,47 @@ void TTrain::OnCommand_sandboxactivate( TTrain *Train, command_data const &Comma
|
|||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggSandButton.UpdateValue( 1.0, Train->dsbSwitch );
|
Train->ggSandButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||||
|
|
||||||
Train->mvControlled->Sandbox( true );
|
Train->mvControlled->SandboxManual( true );
|
||||||
}
|
}
|
||||||
else if( Command.action == GLFW_RELEASE) {
|
else if( Command.action == GLFW_RELEASE) {
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggSandButton.UpdateValue( 0.0 );
|
Train->ggSandButton.UpdateValue( 0.0 );
|
||||||
|
|
||||||
Train->mvControlled->Sandbox( false );
|
Train->mvControlled->SandboxManual( false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TTrain::OnCommand_autosandboxtoggle(TTrain *Train, command_data const &Command) {
|
||||||
|
|
||||||
|
if (Command.action == GLFW_PRESS) {
|
||||||
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
|
if (false == Train->mvOccupied->SandDoseAutoAllow) {
|
||||||
|
// turn on
|
||||||
|
OnCommand_autosandboxactivate(Train, Command);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//turn off
|
||||||
|
OnCommand_autosandboxdeactivate(Train, Command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void TTrain::OnCommand_autosandboxactivate(TTrain *Train, command_data const &Command) {
|
||||||
|
if (Command.action == GLFW_PRESS) {
|
||||||
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
|
Train->mvOccupied->SandboxAutoAllow(true);
|
||||||
|
Train->ggAutoSandAllow.UpdateValue(1.0, Train->dsbSwitch);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void TTrain::OnCommand_autosandboxdeactivate(TTrain *Train, command_data const &Command) {
|
||||||
|
if (Command.action == GLFW_PRESS) {
|
||||||
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
|
Train->mvOccupied->SandboxAutoAllow(false);
|
||||||
|
Train->ggAutoSandAllow.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void TTrain::OnCommand_epbrakecontroltoggle( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_epbrakecontroltoggle( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
@@ -4324,12 +4414,27 @@ void TTrain::OnCommand_springbraketoggle(TTrain *Train, command_data const &Comm
|
|||||||
OnCommand_springbrakedisable(Train, Command);
|
OnCommand_springbrakedisable(Train, Command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (Command.action == GLFW_RELEASE) {
|
||||||
|
// release
|
||||||
|
// visual feedback
|
||||||
|
Train->ggSpringBrakeOffButton.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
|
Train->ggSpringBrakeOnButton.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void TTrain::OnCommand_springbrakeenable(TTrain *Train, command_data const &Command) {
|
void TTrain::OnCommand_springbrakeenable(TTrain *Train, command_data const &Command) {
|
||||||
if (Command.action == GLFW_PRESS) {
|
if (Command.action == GLFW_PRESS) {
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
Train->mvOccupied->SpringBrakeActivate(true);
|
Train->mvOccupied->SpringBrakeActivate(true);
|
||||||
|
// visual feedback
|
||||||
|
Train->ggSpringBrakeOnButton.UpdateValue(1.0, Train->dsbSwitch);
|
||||||
|
Train->ggSpringBrakeToggleButton.UpdateValue(1.0, Train->dsbSwitch);
|
||||||
|
Train->ggSpringBrakeOffButton.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
|
}
|
||||||
|
else if (Command.action == GLFW_RELEASE) {
|
||||||
|
// release
|
||||||
|
// visual feedback
|
||||||
|
Train->ggSpringBrakeOnButton.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -4337,6 +4442,15 @@ void TTrain::OnCommand_springbrakedisable(TTrain *Train, command_data const &Com
|
|||||||
if (Command.action == GLFW_PRESS) {
|
if (Command.action == GLFW_PRESS) {
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
Train->mvOccupied->SpringBrakeActivate(false);
|
Train->mvOccupied->SpringBrakeActivate(false);
|
||||||
|
// visual feedback
|
||||||
|
Train->ggSpringBrakeOffButton.UpdateValue(1.0, Train->dsbSwitch);
|
||||||
|
Train->ggSpringBrakeToggleButton.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
|
Train->ggSpringBrakeOnButton.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
|
}
|
||||||
|
else if (Command.action == GLFW_RELEASE) {
|
||||||
|
// release
|
||||||
|
// visual feedback
|
||||||
|
Train->ggSpringBrakeOffButton.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
void TTrain::OnCommand_springbrakeshutofftoggle(TTrain *Train, command_data const &Command) {
|
void TTrain::OnCommand_springbrakeshutofftoggle(TTrain *Train, command_data const &Command) {
|
||||||
@@ -5237,6 +5351,7 @@ void TTrain::OnCommand_cabchangebackward( TTrain *Train, command_data const &Com
|
|||||||
1 :
|
1 :
|
||||||
-1 ) };
|
-1 ) };
|
||||||
if( false == Train->CabChange( movedirection ) ) {
|
if( false == Train->CabChange( movedirection ) ) {
|
||||||
|
// current vehicle doesn't extend any farther in this direction, check if we there's one connected we can move to
|
||||||
auto const exitdirection { (
|
auto const exitdirection { (
|
||||||
movedirection > 0 ?
|
movedirection > 0 ?
|
||||||
end::front :
|
end::front :
|
||||||
@@ -5858,7 +5973,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
false ) );
|
false ) );
|
||||||
btLampkaWylSzybkiOff.Turn(
|
btLampkaWylSzybkiOff.Turn(
|
||||||
( ( ( mvControlled->MainsInitTimeCountdown > 0.0 )
|
( ( ( mvControlled->MainsInitTimeCountdown > 0.0 )
|
||||||
|| ( fHVoltage == 0.0 )
|
// || ( fHVoltage == 0.0 )
|
||||||
|| ( m_linebreakerstate == 2 )
|
|| ( m_linebreakerstate == 2 )
|
||||||
|| ( true == mvControlled->Mains ) ) ?
|
|| ( true == mvControlled->Mains ) ) ?
|
||||||
false :
|
false :
|
||||||
@@ -6095,7 +6210,10 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
auto const *mover { tmp->MoverParameters };
|
auto const *mover { tmp->MoverParameters };
|
||||||
|
|
||||||
btLampkaWylSzybkiB.Turn( mover->Mains );
|
btLampkaWylSzybkiB.Turn( mover->Mains );
|
||||||
btLampkaWylSzybkiBOff.Turn( ( false == mover->Mains ) && ( mover->MainsInitTimeCountdown <= 0.0 ) && ( fHVoltage != 0.0 ) );
|
btLampkaWylSzybkiBOff.Turn(
|
||||||
|
( false == mover->Mains )
|
||||||
|
&& ( mover->MainsInitTimeCountdown <= 0.0 )
|
||||||
|
/*&& ( fHVoltage != 0.0 )*/ );
|
||||||
|
|
||||||
btLampkaOporyB.Turn(mover->ResistorsFlagCheck());
|
btLampkaOporyB.Turn(mover->ResistorsFlagCheck());
|
||||||
btLampkaBezoporowaB.Turn(
|
btLampkaBezoporowaB.Turn(
|
||||||
@@ -6340,6 +6458,12 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
ggMainButton.Update();
|
ggMainButton.Update();
|
||||||
ggSecurityResetButton.Update();
|
ggSecurityResetButton.Update();
|
||||||
ggReleaserButton.Update();
|
ggReleaserButton.Update();
|
||||||
|
ggSpringBrakeToggleButton.Update();
|
||||||
|
ggSpringBrakeOnButton.Update();
|
||||||
|
ggSpringBrakeOffButton.Update();
|
||||||
|
ggUniveralBrakeButton1.Update();
|
||||||
|
ggUniveralBrakeButton2.Update();
|
||||||
|
ggUniveralBrakeButton3.Update();
|
||||||
ggAntiSlipButton.Update();
|
ggAntiSlipButton.Update();
|
||||||
ggSandButton.Update();
|
ggSandButton.Update();
|
||||||
ggFuseButton.Update();
|
ggFuseButton.Update();
|
||||||
@@ -7674,6 +7798,12 @@ void TTrain::clear_cab_controls()
|
|||||||
ggMainOnButton.Clear();
|
ggMainOnButton.Clear();
|
||||||
ggSecurityResetButton.Clear();
|
ggSecurityResetButton.Clear();
|
||||||
ggReleaserButton.Clear();
|
ggReleaserButton.Clear();
|
||||||
|
ggSpringBrakeToggleButton.Clear();
|
||||||
|
ggSpringBrakeOnButton.Clear();
|
||||||
|
ggSpringBrakeOffButton.Clear();
|
||||||
|
ggUniveralBrakeButton1.Clear();
|
||||||
|
ggUniveralBrakeButton2.Clear();
|
||||||
|
ggUniveralBrakeButton3.Clear();
|
||||||
ggSandButton.Clear();
|
ggSandButton.Clear();
|
||||||
ggAntiSlipButton.Clear();
|
ggAntiSlipButton.Clear();
|
||||||
ggHornButton.Clear();
|
ggHornButton.Clear();
|
||||||
@@ -8263,7 +8393,7 @@ 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 autolights = {
|
std::unordered_map<std::string, bool const *> const autolights = {
|
||||||
{ "i-doorpermit_left:", &mvOccupied->Doors.instances[ ( mvOccupied->ActiveCab == 1 ? side::left : side::right ) ].open_permit },
|
{ "i-doorpermit_left:", &mvOccupied->Doors.instances[ ( mvOccupied->ActiveCab == 1 ? side::left : side::right ) ].open_permit },
|
||||||
{ "i-doorpermit_right:", &mvOccupied->Doors.instances[ ( mvOccupied->ActiveCab == 1 ? side::right : side::left ) ].open_permit },
|
{ "i-doorpermit_right:", &mvOccupied->Doors.instances[ ( mvOccupied->ActiveCab == 1 ? side::right : side::left ) ].open_permit },
|
||||||
{ "i-doorstep:", &mvOccupied->Doors.step_enabled }
|
{ "i-doorstep:", &mvOccupied->Doors.step_enabled }
|
||||||
@@ -8336,7 +8466,14 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
|
|||||||
{ "main_on_bt:", ggMainOnButton },
|
{ "main_on_bt:", ggMainOnButton },
|
||||||
{ "security_reset_bt:", ggSecurityResetButton },
|
{ "security_reset_bt:", ggSecurityResetButton },
|
||||||
{ "releaser_bt:", ggReleaserButton },
|
{ "releaser_bt:", ggReleaserButton },
|
||||||
|
{ "springbraketoggle_bt:", ggSpringBrakeToggleButton },
|
||||||
|
{ "springbrakeon_bt:", ggSpringBrakeOnButton },
|
||||||
|
{ "springbrakeoff_bt:", ggSpringBrakeOffButton },
|
||||||
|
{ "universalbrake1_bt:", ggUniveralBrakeButton1 },
|
||||||
|
{ "universalbrake2_bt:", ggUniveralBrakeButton2 },
|
||||||
|
{ "universalbrake3_bt:", ggUniveralBrakeButton3 },
|
||||||
{ "sand_bt:", ggSandButton },
|
{ "sand_bt:", ggSandButton },
|
||||||
|
{ "autosandallow_sw:", ggAutoSandAllow },
|
||||||
{ "antislip_bt:", ggAntiSlipButton },
|
{ "antislip_bt:", ggAntiSlipButton },
|
||||||
{ "horn_bt:", ggHornButton },
|
{ "horn_bt:", ggHornButton },
|
||||||
{ "hornlow_bt:", ggHornLowButton },
|
{ "hornlow_bt:", ggHornLowButton },
|
||||||
|
|||||||
13
Train.h
13
Train.h
@@ -189,6 +189,9 @@ class TTrain {
|
|||||||
static void OnCommand_independentbrakedecreasefast( TTrain *Train, command_data const &Command );
|
static void OnCommand_independentbrakedecreasefast( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_independentbrakeset( TTrain *Train, command_data const &Command );
|
static void OnCommand_independentbrakeset( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_independentbrakebailoff( TTrain *Train, command_data const &Command );
|
static void OnCommand_independentbrakebailoff( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_universalbrakebutton1(TTrain *Train, command_data const &Command);
|
||||||
|
static void OnCommand_universalbrakebutton2(TTrain *Train, command_data const &Command);
|
||||||
|
static void OnCommand_universalbrakebutton3(TTrain *Train, command_data const &Command);
|
||||||
static void OnCommand_trainbrakeincrease( TTrain *Train, command_data const &Command );
|
static void OnCommand_trainbrakeincrease( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_trainbrakedecrease( TTrain *Train, command_data const &Command );
|
static void OnCommand_trainbrakedecrease( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_trainbrakeset( TTrain *Train, command_data const &Command );
|
static void OnCommand_trainbrakeset( TTrain *Train, command_data const &Command );
|
||||||
@@ -208,6 +211,9 @@ class TTrain {
|
|||||||
static void OnCommand_alarmchaintoggle( TTrain *Train, command_data const &Command );
|
static void OnCommand_alarmchaintoggle( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_wheelspinbrakeactivate( TTrain *Train, command_data const &Command );
|
static void OnCommand_wheelspinbrakeactivate( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_sandboxactivate( TTrain *Train, command_data const &Command );
|
static void OnCommand_sandboxactivate( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_autosandboxtoggle(TTrain *Train, command_data const &Command);
|
||||||
|
static void OnCommand_autosandboxactivate(TTrain *Train, command_data const &Command);
|
||||||
|
static void OnCommand_autosandboxdeactivate(TTrain *Train, command_data const &Command);
|
||||||
static void OnCommand_epbrakecontroltoggle( TTrain *Train, command_data const &Command );
|
static void OnCommand_epbrakecontroltoggle( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_trainbrakeoperationmodeincrease(TTrain *Train, command_data const &Command);
|
static void OnCommand_trainbrakeoperationmodeincrease(TTrain *Train, command_data const &Command);
|
||||||
static void OnCommand_trainbrakeoperationmodedecrease(TTrain *Train, command_data const &Command);
|
static void OnCommand_trainbrakeoperationmodedecrease(TTrain *Train, command_data const &Command);
|
||||||
@@ -426,7 +432,14 @@ public: // reszta może by?publiczna
|
|||||||
TGauge ggMainButton; // EZT
|
TGauge ggMainButton; // EZT
|
||||||
TGauge ggSecurityResetButton;
|
TGauge ggSecurityResetButton;
|
||||||
TGauge ggReleaserButton;
|
TGauge ggReleaserButton;
|
||||||
|
TGauge ggSpringBrakeToggleButton;
|
||||||
|
TGauge ggSpringBrakeOnButton;
|
||||||
|
TGauge ggSpringBrakeOffButton;
|
||||||
|
TGauge ggUniveralBrakeButton1;
|
||||||
|
TGauge ggUniveralBrakeButton2;
|
||||||
|
TGauge ggUniveralBrakeButton3;
|
||||||
TGauge ggSandButton; // guzik piasecznicy
|
TGauge ggSandButton; // guzik piasecznicy
|
||||||
|
TGauge ggAutoSandAllow; // przełącznik piasecznicy
|
||||||
TGauge ggAntiSlipButton;
|
TGauge ggAntiSlipButton;
|
||||||
TGauge ggFuseButton;
|
TGauge ggFuseButton;
|
||||||
TGauge ggConverterFuseButton; // hunter-261211: przycisk odblokowania nadmiarowego przetwornic i ogrzewania
|
TGauge ggConverterFuseButton; // hunter-261211: przycisk odblokowania nadmiarowego przetwornic i ogrzewania
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
|
|||||||
if( false == ismoving ) {
|
if( false == ismoving ) {
|
||||||
//McZapkie-140602: wyzwalanie zdarzenia gdy pojazd stoi
|
//McZapkie-140602: wyzwalanie zdarzenia gdy pojazd stoi
|
||||||
if( ( Owner->Mechanik != nullptr )
|
if( ( Owner->Mechanik != nullptr )
|
||||||
&& ( Owner->Mechanik->Primary() ) ) {
|
&& ( Owner->Mechanik->primary() ) ) {
|
||||||
// tylko dla jednego członu
|
// tylko dla jednego członu
|
||||||
pCurrentTrack->QueueEvents( pCurrentTrack->m_events0, Owner );
|
pCurrentTrack->QueueEvents( pCurrentTrack->m_events0, Owner );
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
|
|||||||
if( SetFlag( iEventFlag, -1 ) ) {
|
if( SetFlag( iEventFlag, -1 ) ) {
|
||||||
// zawsze zeruje flagę sprawdzenia, jak mechanik dosiądzie, to się nie wykona
|
// zawsze zeruje flagę sprawdzenia, jak mechanik dosiądzie, to się nie wykona
|
||||||
if( ( Owner->Mechanik != nullptr )
|
if( ( Owner->Mechanik != nullptr )
|
||||||
&& ( Owner->Mechanik->Primary() ) ) {
|
&& ( Owner->Mechanik->primary() ) ) {
|
||||||
// tylko dla jednego członu
|
// tylko dla jednego członu
|
||||||
// McZapkie-280503: wyzwalanie event tylko dla pojazdow z obsada
|
// McZapkie-280503: wyzwalanie event tylko dla pojazdow z obsada
|
||||||
pCurrentTrack->QueueEvents( pCurrentTrack->m_events1, Owner );
|
pCurrentTrack->QueueEvents( pCurrentTrack->m_events1, Owner );
|
||||||
@@ -149,7 +149,7 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
|
|||||||
if( SetFlag( iEventFlag, -2 ) ) {
|
if( SetFlag( iEventFlag, -2 ) ) {
|
||||||
// zawsze ustawia flagę sprawdzenia, jak mechanik dosiądzie, to się nie wykona
|
// zawsze ustawia flagę sprawdzenia, jak mechanik dosiądzie, to się nie wykona
|
||||||
if( ( Owner->Mechanik != nullptr )
|
if( ( Owner->Mechanik != nullptr )
|
||||||
&& ( Owner->Mechanik->Primary() ) ) {
|
&& ( Owner->Mechanik->primary() ) ) {
|
||||||
// tylko dla jednego członu
|
// tylko dla jednego członu
|
||||||
pCurrentTrack->QueueEvents( pCurrentTrack->m_events2, Owner );
|
pCurrentTrack->QueueEvents( pCurrentTrack->m_events2, Owner );
|
||||||
}
|
}
|
||||||
@@ -250,7 +250,7 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
|
|||||||
{ // gdy zostaje na tym samym torze (przesuwanie już nie zmienia toru)
|
{ // gdy zostaje na tym samym torze (przesuwanie już nie zmienia toru)
|
||||||
if (bPrimary)
|
if (bPrimary)
|
||||||
{ // tylko gdy początkowe ustawienie, dodajemy eventy stania do kolejki
|
{ // tylko gdy początkowe ustawienie, dodajemy eventy stania do kolejki
|
||||||
if (Owner->MoverParameters->ActiveCab != 0) {
|
if (Owner->MoverParameters->CabNo != 0) {
|
||||||
|
|
||||||
pCurrentTrack->QueueEvents( pCurrentTrack->m_events1, Owner, -1.0 );
|
pCurrentTrack->QueueEvents( pCurrentTrack->m_events1, Owner, -1.0 );
|
||||||
pCurrentTrack->QueueEvents( pCurrentTrack->m_events2, Owner, -1.0 );
|
pCurrentTrack->QueueEvents( pCurrentTrack->m_events2, Owner, -1.0 );
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ commanddescription_sequence Commands_descriptions = {
|
|||||||
{ "independentbrakedecreasefast", command_target::vehicle, command_mode::oneoff },
|
{ "independentbrakedecreasefast", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "independentbrakeset", command_target::vehicle, command_mode::oneoff },
|
{ "independentbrakeset", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "independentbrakebailoff", command_target::vehicle, command_mode::oneoff },
|
{ "independentbrakebailoff", command_target::vehicle, command_mode::oneoff },
|
||||||
|
{ "universalbrakebutton1", command_target::vehicle, command_mode::oneoff },
|
||||||
|
{ "universalbrakebutton2", command_target::vehicle, command_mode::oneoff },
|
||||||
|
{ "universalbrakebutton3", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "trainbrakeincrease", command_target::vehicle, command_mode::continuous },
|
{ "trainbrakeincrease", command_target::vehicle, command_mode::continuous },
|
||||||
{ "trainbrakedecrease", command_target::vehicle, command_mode::continuous },
|
{ "trainbrakedecrease", command_target::vehicle, command_mode::continuous },
|
||||||
{ "trainbrakeset", command_target::vehicle, command_mode::oneoff },
|
{ "trainbrakeset", command_target::vehicle, command_mode::oneoff },
|
||||||
@@ -102,9 +105,9 @@ commanddescription_sequence Commands_descriptions = {
|
|||||||
{ "compressorenable", command_target::vehicle, command_mode::oneoff },
|
{ "compressorenable", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "compressordisable", command_target::vehicle, command_mode::oneoff },
|
{ "compressordisable", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "compressortogglelocal", command_target::vehicle, command_mode::oneoff },
|
{ "compressortogglelocal", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "compressorpresetactivatenext", command_target::vehicle, command_mode::oneoff },
|
{ "compressorpresetactivatenext", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "compressorpresetactivateprevious", command_target::vehicle, command_mode::oneoff },
|
{ "compressorpresetactivateprevious", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "compressorpresetactivatedefault", command_target::vehicle, command_mode::oneoff },
|
{ "compressorpresetactivatedefault", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "motoroverloadrelaythresholdtoggle", command_target::vehicle, command_mode::oneoff },
|
{ "motoroverloadrelaythresholdtoggle", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "motoroverloadrelaythresholdsetlow", command_target::vehicle, command_mode::oneoff },
|
{ "motoroverloadrelaythresholdsetlow", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "motoroverloadrelaythresholdsethigh", command_target::vehicle, command_mode::oneoff },
|
{ "motoroverloadrelaythresholdsethigh", command_target::vehicle, command_mode::oneoff },
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ enum class user_command {
|
|||||||
independentbrakedecreasefast,
|
independentbrakedecreasefast,
|
||||||
independentbrakeset,
|
independentbrakeset,
|
||||||
independentbrakebailoff,
|
independentbrakebailoff,
|
||||||
|
universalbrakebutton1,
|
||||||
|
universalbrakebutton2,
|
||||||
|
universalbrakebutton3,
|
||||||
trainbrakeincrease,
|
trainbrakeincrease,
|
||||||
trainbrakedecrease,
|
trainbrakedecrease,
|
||||||
trainbrakeset,
|
trainbrakeset,
|
||||||
@@ -237,7 +240,6 @@ enum class user_command {
|
|||||||
springbrakeshutoffenable,
|
springbrakeshutoffenable,
|
||||||
springbrakeshutoffdisable,
|
springbrakeshutoffdisable,
|
||||||
springbrakerelease,
|
springbrakerelease,
|
||||||
|
|
||||||
radiostop,
|
radiostop,
|
||||||
timejump,
|
timejump,
|
||||||
timejumplarge,
|
timejumplarge,
|
||||||
|
|||||||
@@ -230,7 +230,13 @@ driverkeyboard_input::default_bindings() {
|
|||||||
{ user_command::motorblowersdisableall, GLFW_KEY_M | keymodifier::control },
|
{ user_command::motorblowersdisableall, GLFW_KEY_M | keymodifier::control },
|
||||||
// coolingfanstoggle
|
// coolingfanstoggle
|
||||||
// tempomattoggle
|
// tempomattoggle
|
||||||
|
// springbraketoggle
|
||||||
|
// springbrakeenable
|
||||||
|
// springbrakedisable
|
||||||
|
// springbrakeshutofftoggle
|
||||||
|
// springbrakeshutoffenable
|
||||||
|
// springbrakeshutoffdisable
|
||||||
|
// springbrakerelease
|
||||||
// admin_timejump,
|
// admin_timejump,
|
||||||
{ user_command::timejumplarge, GLFW_KEY_F1 | keymodifier::control },
|
{ user_command::timejumplarge, GLFW_KEY_F1 | keymodifier::control },
|
||||||
{ user_command::timejumpsmall, GLFW_KEY_F1 | keymodifier::shift },
|
{ user_command::timejumpsmall, GLFW_KEY_F1 | keymodifier::shift },
|
||||||
|
|||||||
@@ -578,6 +578,24 @@ drivermouse_input::default_bindings() {
|
|||||||
{ "releaser_bt:", {
|
{ "releaser_bt:", {
|
||||||
user_command::independentbrakebailoff,
|
user_command::independentbrakebailoff,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
{ "springbraketoggle_bt:",{
|
||||||
|
user_command::springbraketoggle,
|
||||||
|
user_command::none } },
|
||||||
|
{ "springbrakeon_bt:",{
|
||||||
|
user_command::springbrakeenable,
|
||||||
|
user_command::none } },
|
||||||
|
{ "springbrakeoff_bt:",{
|
||||||
|
user_command::springbrakedisable,
|
||||||
|
user_command::none } },
|
||||||
|
{ "universalbrake1_bt:",{
|
||||||
|
user_command::universalbrakebutton1,
|
||||||
|
user_command::none } },
|
||||||
|
{ "universalbrake2_bt:",{
|
||||||
|
user_command::universalbrakebutton2,
|
||||||
|
user_command::none } },
|
||||||
|
{ "universalbrake3_bt:",{
|
||||||
|
user_command::universalbrakebutton3,
|
||||||
|
user_command::none } },
|
||||||
{ "sand_bt:", {
|
{ "sand_bt:", {
|
||||||
user_command::sandboxactivate,
|
user_command::sandboxactivate,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ scenario_panel::update() {
|
|||||||
std::get<TDynamicObject *>( simulation::Region->find_vehicle( camera.Pos, 20, false, false ) ) ); // w trybie latania lokalizujemy wg mapy
|
std::get<TDynamicObject *>( simulation::Region->find_vehicle( camera.Pos, 20, false, false ) ) ); // w trybie latania lokalizujemy wg mapy
|
||||||
if( m_nearest == nullptr ) { return; }
|
if( m_nearest == nullptr ) { return; }
|
||||||
auto const *owner { (
|
auto const *owner { (
|
||||||
( ( m_nearest->Mechanik != nullptr ) && ( m_nearest->Mechanik->Primary() ) ) ?
|
( ( m_nearest->Mechanik != nullptr ) && ( m_nearest->Mechanik->primary() ) ) ?
|
||||||
m_nearest->Mechanik :
|
m_nearest->Mechanik :
|
||||||
m_nearest->ctOwner ) };
|
m_nearest->ctOwner ) };
|
||||||
if( owner == nullptr ) { return; }
|
if( owner == nullptr ) { return; }
|
||||||
@@ -202,7 +202,7 @@ scenario_panel::render() {
|
|||||||
if( true == ImGui::Begin( panelname.c_str(), &is_open, flags ) ) {
|
if( true == ImGui::Begin( panelname.c_str(), &is_open, flags ) ) {
|
||||||
// potential assignment section
|
// potential assignment section
|
||||||
auto const *owner { (
|
auto const *owner { (
|
||||||
( ( m_nearest->Mechanik != nullptr ) && ( m_nearest->Mechanik->Primary() ) ) ?
|
( ( m_nearest->Mechanik != nullptr ) && ( m_nearest->Mechanik->primary() ) ) ?
|
||||||
m_nearest->Mechanik :
|
m_nearest->Mechanik :
|
||||||
m_nearest->ctOwner ) };
|
m_nearest->ctOwner ) };
|
||||||
if( owner != nullptr ) {
|
if( owner != nullptr ) {
|
||||||
@@ -255,7 +255,7 @@ timetable_panel::update() {
|
|||||||
if( vehicle == nullptr ) { return; }
|
if( vehicle == nullptr ) { return; }
|
||||||
// if the nearest located vehicle doesn't have a direct driver, try to query its owner
|
// if the nearest located vehicle doesn't have a direct driver, try to query its owner
|
||||||
auto const *owner = (
|
auto const *owner = (
|
||||||
( ( vehicle->Mechanik != nullptr ) && ( vehicle->Mechanik->Primary() ) ) ?
|
( ( vehicle->Mechanik != nullptr ) && ( vehicle->Mechanik->primary() ) ) ?
|
||||||
vehicle->Mechanik :
|
vehicle->Mechanik :
|
||||||
vehicle->ctOwner );
|
vehicle->ctOwner );
|
||||||
if( owner == nullptr ) { return; }
|
if( owner == nullptr ) { return; }
|
||||||
@@ -557,7 +557,7 @@ debug_panel::update_section_vehicle( std::vector<text_line> &Output ) {
|
|||||||
auto const &vehicle { *m_input.vehicle };
|
auto const &vehicle { *m_input.vehicle };
|
||||||
auto const &mover { *m_input.mover };
|
auto const &mover { *m_input.mover };
|
||||||
|
|
||||||
auto const isowned { ( vehicle.Mechanik == nullptr ) && ( vehicle.ctOwner != nullptr ) };
|
auto const isowned { ( vehicle.ctOwner != nullptr ) && ( vehicle.ctOwner->Vehicle() != m_input.vehicle )};
|
||||||
auto const isplayervehicle { ( m_input.train != nullptr ) && ( m_input.train->Dynamic() == m_input.vehicle ) };
|
auto const isplayervehicle { ( m_input.train != nullptr ) && ( m_input.train->Dynamic() == m_input.vehicle ) };
|
||||||
auto const isdieselenginepowered { ( mover.EngineType == TEngineType::DieselElectric ) || ( mover.EngineType == TEngineType::DieselEngine ) };
|
auto const isdieselenginepowered { ( mover.EngineType == TEngineType::DieselElectric ) || ( mover.EngineType == TEngineType::DieselEngine ) };
|
||||||
auto const isdieselinshuntmode { mover.ShuntMode && mover.EngineType == TEngineType::DieselElectric };
|
auto const isdieselinshuntmode { mover.ShuntMode && mover.EngineType == TEngineType::DieselElectric };
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ WyslijObsadzone()
|
|||||||
r.fPar[ 16 * i + 4 ] = vehicle->GetPosition().x;
|
r.fPar[ 16 * i + 4 ] = vehicle->GetPosition().x;
|
||||||
r.fPar[ 16 * i + 5 ] = vehicle->GetPosition().y;
|
r.fPar[ 16 * i + 5 ] = vehicle->GetPosition().y;
|
||||||
r.fPar[ 16 * i + 6 ] = vehicle->GetPosition().z;
|
r.fPar[ 16 * i + 6 ] = vehicle->GetPosition().z;
|
||||||
r.iPar[ 16 * i + 7 ] = static_cast<int>( vehicle->Mechanik->GetAction() );
|
r.iPar[ 16 * i + 7 ] = static_cast<int>( vehicle->Mechanik->action() );
|
||||||
strcpy( r.cString + 64 * i + 32, vehicle->GetTrack()->IsolatedName().c_str() );
|
strcpy( r.cString + 64 * i + 32, vehicle->GetTrack()->IsolatedName().c_str() );
|
||||||
strcpy( r.cString + 64 * i + 48, vehicle->Mechanik->TrainName().c_str() );
|
strcpy( r.cString + 64 * i + 48, vehicle->Mechanik->TrainName().c_str() );
|
||||||
i++;
|
i++;
|
||||||
|
|||||||
@@ -685,7 +685,7 @@ state_serializer::deserialize_endtrainset( cParser &Input, scene::scratch_data &
|
|||||||
for( auto *vehicle : Scratchpad.trainset.vehicles ) {
|
for( auto *vehicle : Scratchpad.trainset.vehicles ) {
|
||||||
// go through list of vehicles in the trainset, coupling them together and checking for potential driver
|
// go through list of vehicles in the trainset, coupling them together and checking for potential driver
|
||||||
if( ( vehicle->Mechanik != nullptr )
|
if( ( vehicle->Mechanik != nullptr )
|
||||||
&& ( vehicle->Mechanik->Primary() ) ) {
|
&& ( vehicle->Mechanik->primary() ) ) {
|
||||||
// primary driver will receive the timetable for this trainset
|
// primary driver will receive the timetable for this trainset
|
||||||
Scratchpad.trainset.driver = vehicle;
|
Scratchpad.trainset.driver = vehicle;
|
||||||
// they'll also receive assignment data if there's any
|
// they'll also receive assignment data if there's any
|
||||||
|
|||||||
Reference in New Issue
Block a user