mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 16:19:19 +02:00
(separate shp reset) add handling of SeparateAcknowledge flag
This commit is contained in:
13
Driver.cpp
13
Driver.cpp
@@ -6376,6 +6376,19 @@ TController::control_horns( double const Timedelta ) {
|
||||
|
||||
void
|
||||
TController::control_security_system( double const Timedelta ) {
|
||||
if( mvOccupied->SecuritySystem.is_cabsignal_blinking() && mvOccupied->SecuritySystem.has_separate_acknowledge()) {
|
||||
// jak zadziałało SHP
|
||||
if( ( false == is_emu() )
|
||||
&& ( mvOccupied->DirActive == 0 ) ) {
|
||||
cue_action( driver_hint::directionforward );
|
||||
}
|
||||
cue_action( driver_hint::shpsystemreset ); // to skasuj
|
||||
if( BrakeCtrlPosition == 0 // TODO: verify whether it's 0 in all vehicle types
|
||||
&& AccDesired > 0.0
|
||||
&& mvOccupied->SecuritySystem.is_braking() ) {
|
||||
cue_action( driver_hint::trainbrakerelease );
|
||||
}
|
||||
}
|
||||
|
||||
if( mvOccupied->SecuritySystem.is_blinking() ) {
|
||||
// jak zadziałało CA/SHP
|
||||
|
||||
@@ -693,6 +693,7 @@ public:
|
||||
bool is_braking() const;
|
||||
bool is_engine_blocked() const;
|
||||
bool radiostop_available() const;
|
||||
bool has_separate_acknowledge() const;
|
||||
void load(std::string const &line, double Vmax);
|
||||
|
||||
double MagnetLocation = 0.0;
|
||||
|
||||
@@ -136,6 +136,7 @@ void TSecuritySystem::update(double dt, double vel, bool pwr, int cab) {
|
||||
bool just_powered_on = !power && pwr;
|
||||
bool just_activated = CabDependent && (cabactive != cab);
|
||||
|
||||
/* enabling battery */
|
||||
if (!DebugModeFlag && cabsignal_enabled && (just_powered_on || just_activated)) {
|
||||
cabsignal_active = true;
|
||||
alert_timer = SoundSignalDelay;
|
||||
@@ -162,6 +163,10 @@ void TSecuritySystem::set_cabsignal() {
|
||||
cabsignal_active = true;
|
||||
}
|
||||
|
||||
bool TSecuritySystem::has_separate_acknowledge() const {
|
||||
return separate_acknowledge;
|
||||
}
|
||||
|
||||
bool TSecuritySystem::is_blinking() const {
|
||||
if (!power)
|
||||
return false;
|
||||
|
||||
10
Train.cpp
10
Train.cpp
@@ -712,7 +712,7 @@ dictionary_source *TTrain::GetTrainState( dictionary_source const &Extraparamete
|
||||
dict->insert( "brake_delay_flag", mvOccupied->BrakeDelayFlag );
|
||||
dict->insert( "brake_op_mode_flag", mvOccupied->BrakeOpModeFlag );
|
||||
// other controls
|
||||
dict->insert( "ca", mvOccupied->SecuritySystem.is_blinking());
|
||||
dict->insert( "ca", mvOccupied->SecuritySystem.is_vigilance_blinking());
|
||||
dict->insert( "shp", mvOccupied->SecuritySystem.is_cabsignal_blinking());
|
||||
dict->insert( "distance_counter", m_distancecounter );
|
||||
dict->insert( "pantpress", std::abs( mvPantographUnit->PantPress ) );
|
||||
@@ -2341,7 +2341,12 @@ void TTrain::OnCommand_alerteracknowledge( TTrain *Train, command_data const &Co
|
||||
void TTrain::OnCommand_cabsignalacknowledge( TTrain *Train, command_data const &Command ) {
|
||||
// TODO: visual feedback
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
if(Train->mvOccupied->SecuritySystem.has_separate_acknowledge()) {
|
||||
Train->mvOccupied->SecuritySystem.cabsignal_reset();
|
||||
Train->ggSHPResetButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||
}
|
||||
} else if( Command.action == GLFW_RELEASE ) {
|
||||
Train->ggSHPResetButton.UpdateValue( 0.0 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7906,6 +7911,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
ggMainOnButton.Update();
|
||||
ggMainButton.Update();
|
||||
ggSecurityResetButton.Update();
|
||||
ggSHPResetButton.Update();
|
||||
ggReleaserButton.Update();
|
||||
ggSpringBrakeOnButton.Update();
|
||||
ggSpringBrakeOffButton.Update();
|
||||
@@ -9258,6 +9264,7 @@ void TTrain::clear_cab_controls()
|
||||
ggMainOffButton.Clear();
|
||||
ggMainOnButton.Clear();
|
||||
ggSecurityResetButton.Clear();
|
||||
ggSHPResetButton.Clear();
|
||||
ggReleaserButton.Clear();
|
||||
ggSpringBrakeOnButton.Clear();
|
||||
ggSpringBrakeOffButton.Clear();
|
||||
@@ -10019,6 +10026,7 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
|
||||
{ "main_off_bt:", ggMainOffButton },
|
||||
{ "main_on_bt:", ggMainOnButton },
|
||||
{ "security_reset_bt:", ggSecurityResetButton },
|
||||
{ "shp_reset_bt:", ggSHPResetButton },
|
||||
{ "releaser_bt:", ggReleaserButton },
|
||||
{ "springbrakeon_bt:", ggSpringBrakeOnButton },
|
||||
{ "springbrakeoff_bt:", ggSpringBrakeOffButton },
|
||||
|
||||
1
Train.h
1
Train.h
@@ -546,6 +546,7 @@ public: // reszta może by?publiczna
|
||||
TGauge ggMainOnButton;
|
||||
TGauge ggMainButton; // EZT
|
||||
TGauge ggSecurityResetButton;
|
||||
TGauge ggSHPResetButton;
|
||||
TGauge ggReleaserButton;
|
||||
TGauge ggSpringBrakeOnButton;
|
||||
TGauge ggSpringBrakeOffButton;
|
||||
|
||||
@@ -1202,7 +1202,18 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return !mvOccupied->SecuritySystem.is_blinking(); } );
|
||||
return !mvOccupied->SecuritySystem.is_vigilance_blinking(); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::shpsystemreset: {
|
||||
if( AIControllFlag ) {
|
||||
if (mvOccupied->SecuritySystem.is_cabsignal_blinking())
|
||||
mvOccupied->SecuritySystem.cabsignal_reset();
|
||||
}
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return !mvOccupied->SecuritySystem.is_cabsignal_blinking(); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::couplingadapterattach: {
|
||||
|
||||
@@ -78,6 +78,7 @@ DRIVER_HINT_DEF(consistlightsoff, STRN("Switch off consist lights"))
|
||||
DRIVER_HINT_DEF(consistheatingon, STRN("Switch on consist heating"))
|
||||
DRIVER_HINT_DEF(consistheatingoff, STRN("Switch off consist heating"))
|
||||
DRIVER_HINT_DEF(securitysystemreset, STRN("Acknowledge alerter"))
|
||||
DRIVER_HINT_DEF(shpsystemreset, STRN("Acknowledge SHP"))
|
||||
DRIVER_HINT_DEF(couplingadapterattach, STRN("Attach coupling adapter"))
|
||||
DRIVER_HINT_DEF(couplingadapterremove, STRN("Remove coupling adapter"))
|
||||
DRIVER_HINT_DEF(secondcontrollersetzero, STRN("Switch off field shunting"))
|
||||
|
||||
@@ -611,6 +611,9 @@ drivermouse_input::default_bindings() {
|
||||
{ "security_reset_bt:", {
|
||||
user_command::alerteracknowledge,
|
||||
user_command::none } },
|
||||
{ "shp_reset_bt:", {
|
||||
user_command::cabsignalacknowledge,
|
||||
user_command::none } },
|
||||
{ "releaser_bt:", {
|
||||
user_command::independentbrakebailoff,
|
||||
user_command::none } },
|
||||
|
||||
@@ -220,6 +220,7 @@ std::string locale::label_cab_control(std::string const &Label)
|
||||
{ "main_off_bt:", STRN("line breaker") },
|
||||
{ "main_on_bt:", STRN("line breaker") },
|
||||
{ "security_reset_bt:", STRN("alerter") },
|
||||
{ "shp_reset_bt:", STRN("shp") },
|
||||
{ "releaser_bt:", STRN("independent brake releaser") },
|
||||
{ "sand_bt:", STRN("sandbox") },
|
||||
{ "antislip_bt:", STRN("wheelspin brake") },
|
||||
|
||||
@@ -495,6 +495,9 @@ std::unordered_map<std::string, vr_openvr::button_bindings> vr_openvr::m_buttonb
|
||||
{ "security_reset_bt:", {
|
||||
user_command::alerteracknowledge,
|
||||
user_command::none } },
|
||||
{ "shp_reset_bt:", {
|
||||
user_command::cabsignalacknowledge,
|
||||
user_command::none } },
|
||||
{ "releaser_bt:", {
|
||||
user_command::independentbrakebailoff,
|
||||
user_command::none } },
|
||||
|
||||
Reference in New Issue
Block a user