17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-10 06:25:31 +01:00

fix(cab): a diesel with only the starter button stops its engine with the main switch off command (eu07/maszyna#427)

The SM03 had no way to stop its engine. Its fuel pump starts on its own, so the fuel pump switch is ignored; the
engine runs the converter feeding the low voltage circuit, so the battery switch doesn't starve the fuel pump either;
and its cab has only the starter button, for which TTrain::OnCommand_linebreakeropen() kept a legacy branch which
animated the button and returned without opening the circuit. MainSwitch(false) itself stops the engine fine.

The command now opens the circuit on diesels whose cab has only the starter button
(TMoverParameters::MainCircuitOpensWithStarterOnly()), without animating the button, which held down would start
the engine again. Other vehicles with only the button closing the circuit keep ignoring the command.

Tests: tests/unit/test_engine_shutdown.cpp, on a shunter made after the SM03.
This commit is contained in:
jerrrrycho
2026-11-07 10:05:10 +01:00
parent 466cbbbfa1
commit 7e426192b7
4 changed files with 136 additions and 1 deletions

View File

@@ -3702,13 +3702,14 @@ void TTrain::OnCommand_linebreakeropen(TTrain *Train, command_data const &Comman
{
Train->ggMainButton.UpdateValue(0.0, Train->dsbSwitch);
}
else if (Train->ggMainOnButton.SubModel != nullptr)
else if (Train->ggMainOnButton.SubModel != nullptr && false == Train->mvControlled->MainCircuitOpensWithStarterOnly())
{
// NOTE: legacy behaviour, for vehicles equipped only with impulse close switch
// it doesn't make any real sense to animate this one, but some people can't get over how there's no visual reaction to their keypress
Train->ggMainOnButton.UpdateValue(1.0, Train->dsbSwitch);
return;
}
// a diesel with only the starter button gets its engine stopped. the button stays put: held down, it would start the engine again
// play sound immediately when the switch is hit, not after release
Train->fMainRelayTimer = 0.0f;