mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-19 16:59:17 +02:00
build 200106. ep brake cab control, battery state cab indicator, additional cab control tooltips, minor bug fixes
This commit is contained in:
@@ -216,9 +216,12 @@ TGauge::Load_mapping( cParser &Input ) {
|
||||
if( key == "type:" ) {
|
||||
auto const gaugetype { Input.getToken<std::string>( true, "\n\r\t ,;" ) };
|
||||
m_type = (
|
||||
gaugetype == "push" ? TGaugeType::push :
|
||||
gaugetype == "impulse" ? TGaugeType::push :
|
||||
gaugetype == "return" ? TGaugeType::push :
|
||||
gaugetype == "delayed" ? TGaugeType::push_delayed :
|
||||
gaugetype == "pushtoggle" ? TGaugeType::pushtoggle :
|
||||
gaugetype == "toggle" ? TGaugeType::toggle :
|
||||
TGaugeType::toggle ); // default
|
||||
}
|
||||
else if( key == "soundinc:" ) {
|
||||
|
||||
5
Gauge.h
5
Gauge.h
@@ -21,9 +21,10 @@ enum class TGaugeAnimation {
|
||||
gt_Digital // licznik cyfrowy, np. kilometrów
|
||||
};
|
||||
|
||||
enum class TGaugeType {
|
||||
toggle,
|
||||
enum class TGaugeType : int {
|
||||
toggle = 1,
|
||||
push,
|
||||
pushtoggle = ( toggle | push ),
|
||||
push_delayed
|
||||
};
|
||||
|
||||
|
||||
@@ -3743,10 +3743,12 @@ void TMoverParameters::CompressorCheck(double dt) {
|
||||
CompressorPower == 0 ? Mains :
|
||||
CompressorPower == 3 ? Mains :
|
||||
( compressorowner != nullptr ) && ( compressorowner->ConverterFlag ) ) };
|
||||
auto const compressorallow {
|
||||
// TBD: split CompressorAllow into separate enable/disable flags, inherit compressor from basic_device
|
||||
auto const compressorenable {
|
||||
( CompressorAllowLocal )
|
||||
&& ( ( CompressorStart == start_t::automatic )
|
||||
|| ( ( compressorowner != nullptr ) && ( compressorowner->CompressorAllow ) ) ) };
|
||||
auto const compressordisable { false == compressorenable };
|
||||
|
||||
auto const pressureistoolow { Compressor < MinCompressorF };
|
||||
auto const pressureistoohigh { Compressor > MaxCompressorF };
|
||||
@@ -3772,9 +3774,10 @@ void TMoverParameters::CompressorCheck(double dt) {
|
||||
auto const compressorflag { CompressorFlag };
|
||||
CompressorFlag =
|
||||
( compressorpower )
|
||||
&& ( false == compressordisable )
|
||||
&& ( ( false == governorlock ) || ( CompressorPower == 3 ) )
|
||||
&& ( ( CompressorFlag )
|
||||
|| ( ( compressorallow ) && ( LastSwitchingTime > CtrlDelay ) ) );
|
||||
|| ( ( compressorenable ) && ( LastSwitchingTime > CtrlDelay ) ) );
|
||||
|
||||
if( ( CompressorFlag ) && ( CompressorFlag != compressorflag ) ) {
|
||||
// jeśli została załączona to trzeba ograniczyć ponowne włączenie
|
||||
@@ -3943,7 +3946,7 @@ void TMoverParameters::UpdatePipePressure(double dt)
|
||||
|| ( true == s_CAtestebrake )
|
||||
|| ( ( true == securitysystempresent )
|
||||
&& ( false == lowvoltagepower ) ) ) {
|
||||
dpMainValve = dpMainValve + PF( 0, PipePress, 0.15 ) * dt;
|
||||
dpMainValve += PF( 0, PipePress, 0.15 ) * dt;
|
||||
}
|
||||
// 0.2*Spg
|
||||
Pipe->Flow(-dpMainValve);
|
||||
|
||||
56
Train.cpp
56
Train.cpp
@@ -1610,27 +1610,43 @@ void TTrain::OnCommand_autosandboxdeactivate(TTrain *Train, command_data const &
|
||||
|
||||
void TTrain::OnCommand_epbrakecontroltoggle( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if( Command.action == GLFW_REPEAT ) { return; }
|
||||
|
||||
auto const ispush{ ( static_cast<int>( Train->ggEPFuseButton.type() ) & static_cast<int>( TGaugeType::push ) ) != 0 };
|
||||
auto const istoggle{ ( static_cast<int>( Train->ggEPFuseButton.type() ) & static_cast<int>( TGaugeType::toggle ) ) != 0 };
|
||||
|
||||
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->EpFuse ) {
|
||||
// turn on
|
||||
if( istoggle ) {
|
||||
// switch state
|
||||
if( false == Train->mvOccupied->EpFuse ) {
|
||||
// turn on
|
||||
if( Train->mvOccupied->EpFuseSwitch( true ) ) {
|
||||
// audio feedback
|
||||
Train->dsbPneumaticSwitch.play();
|
||||
};
|
||||
}
|
||||
else {
|
||||
//turn off
|
||||
Train->mvOccupied->EpFuseSwitch( false );
|
||||
}
|
||||
}
|
||||
else if( ispush ) {
|
||||
// potentially turn on
|
||||
if( Train->mvOccupied->EpFuseSwitch( true ) ) {
|
||||
// audio feedback
|
||||
Train->dsbPneumaticSwitch.play();
|
||||
// visual feedback
|
||||
// NOTE: there's no button for ep brake control switch
|
||||
// TBD, TODO: add ep brake control switch?
|
||||
}
|
||||
};
|
||||
}
|
||||
else {
|
||||
//turn off
|
||||
if( Train->mvOccupied->EpFuseSwitch( false ) ) {
|
||||
// audio feedback
|
||||
Train->dsbPneumaticSwitch.play();
|
||||
// visual feedback
|
||||
// NOTE: there's no button for ep brake control switch
|
||||
// TBD, TODO: add ep brake control switch?
|
||||
}
|
||||
// visual feedback
|
||||
Train->ggEPFuseButton.UpdateValue( (
|
||||
ispush ? 1.0f : // push or pushtoggle
|
||||
Train->mvOccupied->EpFuse ? 1.0f : 0.0f ), // toggle
|
||||
Train->dsbSwitch );
|
||||
}
|
||||
else if( Command.action == GLFW_RELEASE ) {
|
||||
if( ispush ) {
|
||||
// return the switch to neutral position
|
||||
Train->ggEPFuseButton.UpdateValue( 0.0f, Train->dsbSwitch );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6668,6 +6684,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
ggUniveralBrakeButton1.Update();
|
||||
ggUniveralBrakeButton2.Update();
|
||||
ggUniveralBrakeButton3.Update();
|
||||
ggEPFuseButton.Update();
|
||||
ggAntiSlipButton.Update();
|
||||
ggSandButton.Update();
|
||||
ggAutoSandButton.Update();
|
||||
@@ -7924,6 +7941,7 @@ void TTrain::clear_cab_controls()
|
||||
ggUniveralBrakeButton1.Clear();
|
||||
ggUniveralBrakeButton2.Clear();
|
||||
ggUniveralBrakeButton3.Clear();
|
||||
ggEPFuseButton.Clear();
|
||||
ggSandButton.Clear();
|
||||
ggAutoSandButton.Clear();
|
||||
ggAntiSlipButton.Clear();
|
||||
@@ -7936,7 +7954,7 @@ void TTrain::clear_cab_controls()
|
||||
ggSpeedControlIncreaseButton.Clear();
|
||||
ggSpeedControlDecreaseButton.Clear();
|
||||
ggSpeedControlPowerIncreaseButton.Clear();
|
||||
ggSpeedControlDecreaseButton.Clear();
|
||||
ggSpeedControlPowerDecreaseButton.Clear();
|
||||
for (auto &speedctrlbutton : ggSpeedCtrlButtons) {
|
||||
speedctrlbutton.Clear();
|
||||
}
|
||||
@@ -8540,7 +8558,8 @@ bool TTrain::initialize_button(cParser &Parser, std::string const &Label, int co
|
||||
{ "i-doorpermit_left:", &mvOccupied->Doors.instances[ ( cab_to_end() == end::front ? side::left : side::right ) ].open_permit },
|
||||
{ "i-doorpermit_right:", &mvOccupied->Doors.instances[ ( cab_to_end() == end::front ? side::right : side::left ) ].open_permit },
|
||||
{ "i-doorstep:", &mvOccupied->Doors.step_enabled },
|
||||
{ "i-mainpipelock:", &mvOccupied->LockPipe }
|
||||
{ "i-mainpipelock:", &mvOccupied->LockPipe },
|
||||
{ "i-battery:", &mvOccupied->Battery }
|
||||
};
|
||||
{
|
||||
auto lookup = autolights.find( Label );
|
||||
@@ -8616,6 +8635,7 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
|
||||
{ "universalbrake1_bt:", ggUniveralBrakeButton1 },
|
||||
{ "universalbrake2_bt:", ggUniveralBrakeButton2 },
|
||||
{ "universalbrake3_bt:", ggUniveralBrakeButton3 },
|
||||
{ "epbrake_bt:", ggEPFuseButton },
|
||||
{ "sand_bt:", ggSandButton },
|
||||
{ "autosandallow_sw:", ggAutoSandButton },
|
||||
{ "antislip_bt:", ggAntiSlipButton },
|
||||
|
||||
1
Train.h
1
Train.h
@@ -449,6 +449,7 @@ public: // reszta może by?publiczna
|
||||
TGauge ggUniveralBrakeButton1;
|
||||
TGauge ggUniveralBrakeButton2;
|
||||
TGauge ggUniveralBrakeButton3;
|
||||
TGauge ggEPFuseButton;
|
||||
TGauge ggSandButton; // guzik piasecznicy
|
||||
TGauge ggAutoSandButton; // przełącznik piasecznicy
|
||||
TGauge ggAntiSlipButton;
|
||||
|
||||
@@ -605,6 +605,9 @@ drivermouse_input::default_bindings() {
|
||||
{ "universalbrake3_bt:",{
|
||||
user_command::universalbrakebutton3,
|
||||
user_command::none } },
|
||||
{ "epbrake_bt:",{
|
||||
user_command::epbrakecontroltoggle,
|
||||
user_command::none } },
|
||||
{ "sand_bt:", {
|
||||
user_command::sandboxactivate,
|
||||
user_command::none } },
|
||||
|
||||
@@ -111,6 +111,10 @@ init() {
|
||||
"line breaker",
|
||||
"alerter",
|
||||
"independent brake releaser",
|
||||
"spring brake",
|
||||
"spring brake",
|
||||
"spring brake",
|
||||
"electro-pneumatic brake",
|
||||
"sandbox",
|
||||
"wheelspin brake",
|
||||
"horn",
|
||||
@@ -281,6 +285,10 @@ init() {
|
||||
"wylacznik szybki",
|
||||
"czuwak",
|
||||
"odluzniacz",
|
||||
"hamulec sprezynowy",
|
||||
"hamulec sprezynowy",
|
||||
"hamulec sprezynowy",
|
||||
"hamulec elektropneumatyczny",
|
||||
"piasecznica",
|
||||
"hamulec przeciwposlizgowy",
|
||||
"syrena",
|
||||
@@ -404,6 +412,10 @@ init() {
|
||||
"main_on_bt:",
|
||||
"security_reset_bt:",
|
||||
"releaser_bt:",
|
||||
"springbraketoggle_bt:",
|
||||
"springbrakeon_bt:",
|
||||
"springbrakeoff_bt:",
|
||||
"epbrake_bt:",
|
||||
"sand_bt:",
|
||||
"antislip_bt:",
|
||||
"horn_bt:",
|
||||
|
||||
@@ -100,6 +100,10 @@ enum string {
|
||||
cab_main_on_bt,
|
||||
cab_security_reset_bt,
|
||||
cab_releaser_bt,
|
||||
cab_springbrake_bt,
|
||||
cab_springbrakeon_bt,
|
||||
cab_springbrakeoff_bt,
|
||||
cab_epbrake_bt,
|
||||
cab_sand_bt,
|
||||
cab_antislip_bt,
|
||||
cab_horn_bt,
|
||||
|
||||
Reference in New Issue
Block a user