16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-17 23:39:18 +02:00

Fix AI drivers going with dark lights

This commit is contained in:
2025-01-09 15:10:16 +01:00
parent 91722c2590
commit ab227afedb
2 changed files with 40 additions and 33 deletions

View File

@@ -5704,6 +5704,7 @@ void TController::TakeControl( bool const Aidriver, bool const Forcevehiclecheck
{ // teraz AI prowadzi { // teraz AI prowadzi
AIControllFlag = AIdriver; AIControllFlag = AIdriver;
pVehicle->Controller = AIdriver; pVehicle->Controller = AIdriver;
control_lights(); // reinicjalizacja swiatel
mvOccupied->CabActivisation(true); mvOccupied->CabActivisation(true);
iDirection = 0; // kierunek jazdy trzeba dopiero zgadnąć iDirection = 0; // kierunek jazdy trzeba dopiero zgadnąć
TableClear(); // ponowne utworzenie tabelki, bo człowiek mógł pojechać niezgodnie z sygnałami TableClear(); // ponowne utworzenie tabelki, bo człowiek mógł pojechać niezgodnie z sygnałami
@@ -5740,6 +5741,8 @@ void TController::TakeControl( bool const Aidriver, bool const Forcevehiclecheck
} }
else else
{ // a teraz użytkownik { // a teraz użytkownik
if (!is_train() || !is_car()) // gasimy swiatla jesli przejmujemy odstawione
pVehicle->RaLightsSet(0, 0);
AIControllFlag = Humandriver; AIControllFlag = Humandriver;
pVehicle->Controller = Humandriver; pVehicle->Controller = Humandriver;
if( eAction == TAction::actSleep ) { if( eAction == TAction::actSleep ) {

View File

@@ -7094,39 +7094,43 @@ void TDynamicObject::RaLightsSet(int head, int rear)
MoverParameters->iLights[ vehicleend ] = ( head & iInventory[ vehicleend ] ); MoverParameters->iLights[ vehicleend ] = ( head & iInventory[ vehicleend ] );
bool tLeft = MoverParameters->iLights[vehicleend] & (light::auxiliary_left | light::headlight_left); // roboczo czy jakiekolwiek swiatlo z lewej jest zapalone bool tLeft = MoverParameters->iLights[vehicleend] & (light::auxiliary_left | light::headlight_left); // roboczo czy jakiekolwiek swiatlo z lewej jest zapalone
bool tRight = MoverParameters->iLights[vehicleend] & (light::auxiliary_right | light::headlight_right); // a tu z prawej bool tRight = MoverParameters->iLights[vehicleend] & (light::auxiliary_right | light::headlight_right); // a tu z prawej
switch (MoverParameters->modernDimmerState) if (Controller == Humandriver) {
{ switch (MoverParameters->modernDimmerState)
case 0: {
// wylaczone case 0:
MoverParameters->iLights[vehicleend] &= 0 | light::rearendsignals; // zostawiamy tylko tabliczki jesli sa // wylaczone
HighBeamLights = false; MoverParameters->iLights[vehicleend] &= 0 | light::rearendsignals; // zostawiamy tylko tabliczki jesli sa
DimHeadlights = false; HighBeamLights = false;
break; DimHeadlights = false;
case 1: break;
// przyciemnione normalne case 1:
DimHeadlights = true; // odpalamy przyciemnienie normalnych reflektorow // przyciemnione normalne
HighBeamLights = false; DimHeadlights = true; // odpalamy przyciemnienie normalnych reflektorow
break; HighBeamLights = false;
case 3: break;
// dlugie przyciemnione case 3:
DimHeadlights = true; // dlugie przyciemnione
HighBeamLights = true; DimHeadlights = true;
MoverParameters->iLights[vehicleend] &= light::headlight_upper | light::rearendsignals | light::redmarker_left | light::redmarker_right | light::rearendsignals; // nie ruszamy gornych i koncowek HighBeamLights = true;
MoverParameters->iLights[vehicleend] |= tLeft ? light::highbeamlight_left : 0; // jesli swiatlo z lewej zapalone to odpal dlugie MoverParameters->iLights[vehicleend] &=
MoverParameters->iLights[vehicleend] |= tRight ? light::highbeamlight_right : 0; // a tu z prawej light::headlight_upper | light::rearendsignals | light::redmarker_left | light::redmarker_right | light::rearendsignals; // nie ruszamy gornych i koncowek
break; MoverParameters->iLights[vehicleend] |= tLeft ? light::highbeamlight_left : 0; // jesli swiatlo z lewej zapalone to odpal dlugie
case 4: MoverParameters->iLights[vehicleend] |= tRight ? light::highbeamlight_right : 0; // a tu z prawej
// zwykle dlugie break;
DimHeadlights = false; case 4:
HighBeamLights = true; // zwykle dlugie
MoverParameters->iLights[vehicleend] &= light::headlight_upper | light::rearendsignals | light::redmarker_left | light::redmarker_right | light::rearendsignals; // nie ruszamy gornych i koncowek DimHeadlights = false;
MoverParameters->iLights[vehicleend] |= tLeft ? light::highbeamlight_left : 0; // jesli swiatlo z lewej zapalone to odpal dlugie HighBeamLights = true;
MoverParameters->iLights[vehicleend] |= tRight ? light::highbeamlight_right : 0; // a tu z prawej MoverParameters->iLights[vehicleend] &=
break; light::headlight_upper | light::rearendsignals | light::redmarker_left | light::redmarker_right | light::rearendsignals; // nie ruszamy gornych i koncowek
default: // to case 2 - zwykle MoverParameters->iLights[vehicleend] |= tLeft ? light::highbeamlight_left : 0; // jesli swiatlo z lewej zapalone to odpal dlugie
DimHeadlights = false; MoverParameters->iLights[vehicleend] |= tRight ? light::highbeamlight_right : 0; // a tu z prawej
HighBeamLights = false; break;
break; default: // to case 2 - zwykle
DimHeadlights = false;
HighBeamLights = false;
break;
}
} }
} }