17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-30 19:00:28 +01:00

fix(ai): keep the light selector lookup within its table, Sonar findings of the handover

- the light selector size comes from the vehicle definition (LightsList Size)
  and isn't limited, while the table holds 18 positions; a bigger selector
  read past the table, and so did a table index other than the front or
  rear one. Only the positions the table holds are looked at now, and the
  selector stays where it is for a bad table index (cpp:S2259),
- the lambdas of the handover capture what they use explicitly (cpp:S3608),
- the chained assignments resetting the headlight state on the AI taking
  over are split (cpp:S1121).
This commit is contained in:
jerrrrycho
2026-10-15 21:28:20 +02:00
parent 54990f41a6
commit 7727748b76
3 changed files with 30 additions and 7 deletions

View File

@@ -5564,8 +5564,10 @@ void TController::TakeControl( bool const Aidriver, bool const Forcevehiclecheck
pVehicle->Controller = AIdriver;
// the AI doesn't operate the headlight dimmer, drop the state left by the human driver
// so the lights set by the AI aren't hidden (dimmer in off position) or dimmed
pVehicle->HeadlightsAoff = pVehicle->HeadlightsBoff = false;
pVehicle->DimHeadlights = pVehicle->HighBeamLights = false;
pVehicle->HeadlightsAoff = false;
pVehicle->HeadlightsBoff = false;
pVehicle->DimHeadlights = false;
pVehicle->HighBeamLights = false;
control_lights(); // reinicjalizacja swiatel
mvOccupied->CabActivisation(true);
iDirection = 0; // kierunek jazdy trzeba dopiero zgadnąć