mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
(commands) Add alarmchainenable and alarmchaindisable commands
This commit is contained in:
56
Train.cpp
56
Train.cpp
@@ -246,6 +246,8 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
|
||||
{ user_command::manualbrakeincrease, &TTrain::OnCommand_manualbrakeincrease },
|
||||
{ user_command::manualbrakedecrease, &TTrain::OnCommand_manualbrakedecrease },
|
||||
{ user_command::alarmchaintoggle, &TTrain::OnCommand_alarmchaintoggle },
|
||||
{ user_command::alarmchainenable, &TTrain::OnCommand_alarmchainenable},
|
||||
{ user_command::alarmchaindisable, &TTrain::OnCommand_alarmchaindisable},
|
||||
{ user_command::wheelspinbrakeactivate, &TTrain::OnCommand_wheelspinbrakeactivate },
|
||||
{ user_command::sandboxactivate, &TTrain::OnCommand_sandboxactivate },
|
||||
{ user_command::autosandboxtoggle, &TTrain::OnCommand_autosandboxtoggle },
|
||||
@@ -1047,7 +1049,7 @@ void TTrain::OnCommand_jointcontrollerset( TTrain *Train, command_data const &Co
|
||||
// on press or hold
|
||||
// value controls brake in range 0-0.5, master controller in range 0.5-1.0
|
||||
if( Command.param1 >= 0.5 ) {
|
||||
Train->set_master_controller(
|
||||
Train->set_master_controller(
|
||||
( Command.param1 * 2 - 1 )
|
||||
* ( Train->mvControlled->CoupledCtrl ?
|
||||
Train->mvControlled->MainCtrlPosNo + Train->mvControlled->ScndCtrlPosNo :
|
||||
@@ -1822,20 +1824,36 @@ void TTrain::OnCommand_alarmchaintoggle( TTrain *Train, command_data const &Comm
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
|
||||
if( false == Train->mvOccupied->AlarmChainFlag ) {
|
||||
// pull
|
||||
Train->mvOccupied->AlarmChainSwitch( true );
|
||||
// visual feedback
|
||||
Train->ggAlarmChain.UpdateValue( 1.0 );
|
||||
OnCommand_alarmchainenable(Train, Command);
|
||||
}
|
||||
else {
|
||||
// release
|
||||
Train->mvOccupied->AlarmChainSwitch( false );
|
||||
// visual feedback
|
||||
Train->ggAlarmChain.UpdateValue( 0.0 );
|
||||
OnCommand_alarmchaindisable(Train, Command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_alarmchainenable(TTrain *Train, command_data const &Command)
|
||||
{
|
||||
if (Command.action == GLFW_PRESS) {
|
||||
|
||||
// pull
|
||||
Train->mvOccupied->AlarmChainSwitch(true);
|
||||
// visual feedback
|
||||
Train->ggAlarmChain.UpdateValue(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TTrain::OnCommand_alarmchaindisable(TTrain *Train, command_data const &Command) {
|
||||
if (Command.action == GLFW_PRESS) {
|
||||
|
||||
// release
|
||||
Train->mvOccupied->AlarmChainSwitch(false);
|
||||
// visual feedback
|
||||
Train->ggAlarmChain.UpdateValue(0.0);
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_wheelspinbrakeactivate( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
// TODO: proper control deviced definition for the interiors, that doesn't hinge of presence of 3d submodels
|
||||
@@ -3682,7 +3700,7 @@ void TTrain::OnCommand_compressorpresetactivateprevious(TTrain *Train, command_d
|
||||
if( Train->ggCompressorListButton.type() == TGaugeType::push ) {
|
||||
// impulse switch toggles only between positions 'default' and 'default+1'
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((Train->mvOccupied->CompressorListPos > 1)
|
||||
|| (true == Train->mvOccupied->CompressorListWrap)) {
|
||||
@@ -5215,7 +5233,7 @@ void TTrain::OnCommand_heatingdisable( TTrain *Train, command_data const &Comman
|
||||
|
||||
Train->mvOccupied->HeatingSwitch( false );
|
||||
// visual feedback
|
||||
Train->ggTrainHeatingButton.UpdateValue(
|
||||
Train->ggTrainHeatingButton.UpdateValue(
|
||||
( Train->ggTrainHeatingButton.type() == TGaugeType::push ?
|
||||
1.0 :
|
||||
0.0 ),
|
||||
@@ -5351,7 +5369,7 @@ void TTrain::OnCommand_springbrakeshutoffdisable(TTrain *Train, command_data con
|
||||
void TTrain::OnCommand_springbrakerelease(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
|
||||
|
||||
|
||||
auto *vehicle{ Train->find_nearest_consist_vehicle(Command.freefly, Command.location) };
|
||||
if (vehicle == nullptr) { return; }
|
||||
Train->mvOccupied->SpringBrakeRelease();
|
||||
@@ -5455,7 +5473,7 @@ void TTrain::OnCommand_inverterenable(TTrain *Train, command_data const &Command
|
||||
{
|
||||
itemindex -= p->MoverParameters->InvertersNo;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
p = (kier ? p->Next(flag) : p->Prev(flag));
|
||||
}
|
||||
@@ -6618,8 +6636,8 @@ void TTrain::UpdateCab() {
|
||||
|
||||
// Ra: przesiadka, jeśli AI zmieniło kabinę (a człon?)...
|
||||
if( ( DynamicObject->Mechanik ) // może nie być?
|
||||
&& ( DynamicObject->Mechanik->AIControllFlag ) ) {
|
||||
|
||||
&& ( DynamicObject->Mechanik->AIControllFlag ) ) {
|
||||
|
||||
if( iCabn != ( // numer kabiny (-1: kabina B)
|
||||
mvOccupied->CabOccupied == -1 ?
|
||||
2 :
|
||||
@@ -7650,7 +7668,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (DynamicObject->Mechanik ?
|
||||
(DynamicObject->Mechanik->AIControllFlag ? false :
|
||||
(DynamicObject->Mechanik->AIControllFlag ? false :
|
||||
(Global.iFeedbackMode == 4 /*|| (Global.bMWDmasterEnable && Global.bMWDBreakEnable)*/)) :
|
||||
false && Global.fCalibrateIn[ 0 ][ 1 ] != 0.0) // nie blokujemy AI
|
||||
{ // Ra: nie najlepsze miejsce, ale na początek gdzieś to dać trzeba
|
||||
@@ -7844,7 +7862,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
ggHelperButton.UpdateValue( DynamicObject->Mechanik->HelperState );
|
||||
}
|
||||
ggHelperButton.Update();
|
||||
|
||||
|
||||
ggSpeedControlIncreaseButton.Update( lowvoltagepower );
|
||||
ggSpeedControlDecreaseButton.Update( lowvoltagepower );
|
||||
ggSpeedControlPowerIncreaseButton.Update( lowvoltagepower );
|
||||
@@ -8043,7 +8061,7 @@ TTrain::update_sounds( double const Deltatime ) {
|
||||
rsHissX->stop();
|
||||
}
|
||||
}
|
||||
// upuszczanie z czasowego
|
||||
// upuszczanie z czasowego
|
||||
if( rsHissT ) {
|
||||
volume = mvOccupied->Handle->GetSound( s_fv4a_t ) * rsHissT->m_amplitudefactor + +rsHissT->m_amplitudeoffset;
|
||||
if( volume * brakevolumescale > 0.05 ) {
|
||||
@@ -9701,7 +9719,7 @@ void TTrain::set_cab_controls( int const Cab ) {
|
||||
p = (kier ? p->Next(flag) : p->Prev(flag));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// we reset all indicators, as they're set during the update pass
|
||||
// TODO: when cleaning up break setting indicator state into a separate function, so we can reuse it
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user