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

Merge master into fix/et42-fans-compressor-lamps-et22-louvre

Resolves the MOVER.h conflict (both sides add independent helpers) so the
pull request builds run again.
This commit is contained in:
jerrrrycho
2026-11-08 03:11:17 +01:00
19 changed files with 827 additions and 101 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;
@@ -5234,15 +5235,37 @@ void TTrain::OnCommand_headlighttoggleleft(TTrain *Train, command_data const &Co
if (Command.action == GLFW_PRESS)
{
// only reacting to press, so the switch doesn't flip back and forth if key is held down
if ((Train->mvOccupied->iLights[vehicleend] & light::headlight_left) == 0)
if (Train->ggLeftEndLightButton.SubModel != nullptr || Train->ggLeftLightButton.SubModel == nullptr)
{
// turn on
OnCommand_headlightenableleft(Train, Command);
}
else
{
// turn off
OnCommand_headlightdisableleft(Train, Command);
if ((Train->mvOccupied->iLights[vehicleend] & light::headlight_left) == 0)
{
// turn on
OnCommand_headlightenableleft(Train, Command);
}
else
{
// turn off
OnCommand_headlightdisableleft(Train, Command);
}
} else {
// if the light is controlled by 3-way switch, handle both headlight and redmarker
if ((Train->mvOccupied->iLights[vehicleend] & light::headlight_left) == 0 &&
(Train->mvOccupied->iLights[vehicleend] & light::redmarker_left) == 0)
{
// turn on
OnCommand_headlightenableleft(Train, Command);
}
else if (Train->mvOccupied->iLights[vehicleend] & light::headlight_left)
{
// switch to red
OnCommand_redmarkerenableleft(Train, Command);
}
else
{
// disable
OnCommand_redmarkerdisableleft(Train, Command);
}
}
}
}
@@ -5317,15 +5340,37 @@ void TTrain::OnCommand_headlighttoggleright(TTrain *Train, command_data const &C
if (Command.action == GLFW_PRESS)
{
// only reacting to press, so the switch doesn't flip back and forth if key is held down
if ((Train->mvOccupied->iLights[vehicleend] & light::headlight_right) == 0)
if (Train->ggRightEndLightButton.SubModel != nullptr || Train->ggRightLightButton.SubModel == nullptr)
{
// turn on
OnCommand_headlightenableright(Train, Command);
}
else
{
// turn off
OnCommand_headlightdisableright(Train, Command);
if ((Train->mvOccupied->iLights[vehicleend] & light::headlight_right) == 0)
{
// turn on
OnCommand_headlightenableright(Train, Command);
}
else
{
// turn off
OnCommand_headlightdisableright(Train, Command);
}
} else {
// if the light is controlled by 3-way switch, handle both headlight and redmarker
if ((Train->mvOccupied->iLights[vehicleend] & light::headlight_right) == 0 &&
(Train->mvOccupied->iLights[vehicleend] & light::redmarker_right) == 0)
{
// turn on
OnCommand_headlightenableright(Train, Command);
}
else if (Train->mvOccupied->iLights[vehicleend] & light::headlight_right)
{
// switch to red
OnCommand_redmarkerenableright(Train, Command);
}
else
{
// disable
OnCommand_redmarkerdisableright(Train, Command);
}
}
}
}