From af4edcc734b89b6e83f55e0faeae008726bcbe17 Mon Sep 17 00:00:00 2001 From: Hirek Date: Wed, 1 Oct 2025 22:58:13 +0200 Subject: [PATCH] Fix lightsset logic --- DynObj.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/DynObj.cpp b/DynObj.cpp index 7f740985..d259b0c9 100644 --- a/DynObj.cpp +++ b/DynObj.cpp @@ -7350,8 +7350,15 @@ void TDynamicObject::SetLights() { auto *vehicle { GetFirstDynamic( MoverParameters->CabOccupied >= 0 ? end::front : end::rear, coupling::control ) }; while( vehicle != nullptr ) { // set lights on given side if there's no coupling with another vehicle, turn them off otherwise - auto const *frontvehicle { ( isfrontcaboccupied ? vehicle->Prev( coupling::coupler ) : vehicle->Next( coupling::coupler ) ) }; - auto const *rearvehicle { ( isfrontcaboccupied ? vehicle->Next( coupling::coupler ) : vehicle->Prev( coupling::coupler ) ) }; + auto const *frontvehicle{(isfrontcaboccupied ? vehicle->Prev(coupling::coupler) : vehicle->Next(coupling::coupler))}; + auto const *rearvehicle{(isfrontcaboccupied ? vehicle->Next(coupling::coupler) : vehicle->Prev(coupling::coupler))}; + + if (MoverParameters->LightsPos == 18) + { + frontvehicle = nullptr; + rearvehicle = nullptr; + } + vehicle->RaLightsSet( ( frontvehicle == nullptr ? frontlights : 0 ), ( rearvehicle == nullptr ? rearlights : 0 ) );