mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-19 01:46:01 +01:00
fix(lights): keep the headlight dimmer position within the DimmerList
modernDimmerPosition indexed dimPositions without a range check in RaLightsSet(), SetLightDimmings() and the off_from_dimmer value of the cab's Python state. An empty DimmerList, or a DefaultPos past the end of a short one, read past the end of the vector; the dimmer commands could also leave or put the position outside the list. Reads go through currentDimPosition(), a plain entry (not off, not dimmed) outside the list. DefaultPos and the position are clamped after the .fiz is loaded, the increase/decrease commands step through stepDimmerPosition(), which clamps and does nothing for an empty list, and headlightsdimenable clamps its position 1.
This commit is contained in:
@@ -7350,9 +7350,7 @@ void TDynamicObject::RaLightsSet(int head, int rear)
|
||||
bool tRight = MoverParameters->iLights[vehicleend] & (light::auxiliary_right | light::headlight_right); // a tu z prawej
|
||||
if (Controller == Humandriver) {
|
||||
|
||||
int ¤tDimPos = MoverParameters->modernDimmerPosition;
|
||||
auto &dimmerPositions = MoverParameters->dimPositions;
|
||||
TMoverParameters::dimPosition dps = dimmerPositions[currentDimPos];
|
||||
auto const dps{MoverParameters->currentDimPosition()};
|
||||
|
||||
// domyślnie
|
||||
HighBeamLights = false;
|
||||
@@ -7414,9 +7412,7 @@ void TDynamicObject::SetLightDimmings()
|
||||
if (Controller == Humandriver)
|
||||
{
|
||||
|
||||
int ¤tDimPos = MoverParameters->modernDimmerPosition;
|
||||
auto &dimmerPositions = MoverParameters->dimPositions;
|
||||
TMoverParameters::dimPosition dps = dimmerPositions[currentDimPos];
|
||||
auto const dps{MoverParameters->currentDimPosition()};
|
||||
|
||||
// domyślnie
|
||||
HighBeamLights = false;
|
||||
|
||||
Reference in New Issue
Block a user