Added automatic sanding allowance switch

This commit is contained in:
Królik Uszasty
2019-09-09 23:05:45 +02:00
committed by tmj-fstate
parent b6ca21d280
commit 12a95fc423
4 changed files with 57 additions and 2 deletions

View File

@@ -1491,9 +1491,10 @@ public:
bool AddPulseForce(int Multipler);/*dla drezyny*/
bool SandboxManual( bool const State, range_t const Notify = range_t::consist );/*wlacza/wylacza sypanie piasku*/
bool SandboxAuto( bool const State, range_t const Notify = range_t::consist );/*wlacza/wylacza sypanie piasku*/
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 SandboxAutoAllow(bool const State);/*wlacza/wylacza zezwolenie na automatyczne sypanie piasku*/
/*! zbijanie czuwaka/SHP*/
void SSReset(void);

View File

@@ -2441,6 +2441,24 @@ bool TMoverParameters::Sandbox( bool const State, range_t const Notify )
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;
}
void TMoverParameters::SSReset(void)
{ // funkcja pomocnicza dla SecuritySystemReset - w Delphi Reset()
SecuritySystem.SystemTimer = 0;

View File

@@ -1447,6 +1447,37 @@ void TTrain::OnCommand_sandboxactivate( TTrain *Train, command_data const &Comma
}
}
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 ) {
if( Command.action == GLFW_PRESS ) {
@@ -8122,6 +8153,7 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
{ "security_reset_bt:", ggSecurityResetButton },
{ "releaser_bt:", ggReleaserButton },
{ "sand_bt:", ggSandButton },
{ "autosandallow_sw:", ggAutoSandAllow },
{ "antislip_bt:", ggAntiSlipButton },
{ "horn_bt:", ggHornButton },
{ "hornlow_bt:", ggHornLowButton },

View File

@@ -200,6 +200,9 @@ class TTrain {
static void OnCommand_alarmchaintoggle( 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_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_trainbrakeoperationmodeincrease(TTrain *Train, command_data const &Command);
static void OnCommand_trainbrakeoperationmodedecrease(TTrain *Train, command_data const &Command);
@@ -413,6 +416,7 @@ public: // reszta może by?publiczna
TGauge ggSecurityResetButton;
TGauge ggReleaserButton;
TGauge ggSandButton; // guzik piasecznicy
TGauge ggAutoSandAllow; // przełącznik piasecznicy
TGauge ggAntiSlipButton;
TGauge ggFuseButton;
TGauge ggConverterFuseButton; // hunter-261211: przycisk odblokowania nadmiarowego przetwornic i ogrzewania