18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-21 16:44:58 +01:00

feat: light programmer positions can switch the cab light (eu07/maszyna#529)

An optional third column in the LightsList rows of the .fiz sets the cab
interior light when the driver moves the light preset selector to that
position: 0 off, 1 on, 3 on dimmed (bit 2 the dimmer). Rows without the
column, or with a negative value, leave the cab light to its own switch,
so the existing tables work as before; a stray note after the two light
columns (e.g. "38 38 / A") is not read as the flag.

The light follows the occupied cab, or all cabs of a JointCabs vehicle,
as with the interior light commands; the dimmer switch is moved along.
The lightsset custom position and the AI leave the cab light alone.

Covered by tests/unit/test_lights_preset_cablight.cpp.

(eu07/maszyna#529)
This commit is contained in:
jerrrrycho
2026-11-07 23:13:00 +01:00
parent 68fdf1efdf
commit d3dd883700
5 changed files with 188 additions and 0 deletions

View File

@@ -189,6 +189,8 @@ class TTrain {
// sets cabin controls based on current state of the vehicle
// NOTE: we can get rid of this function once we have per-cab persistent state
void set_cab_controls( int const Cab );
// sets the cab interior light as the selected light preset says, if it says anything (eu07/maszyna#529)
void set_cab_light_from_lights_preset();
// initializes a gauge matching provided label. returns: true if the label was found, false otherwise
bool initialize_gauge(cParser &Parser, std::string const &Label, int const Cabindex);
// initializes a button matching provided label. returns: true if the label was found, false otherwise