mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 16:36:53 +01:00
fix(vehicle): the headlight dimmer by the active cab, the pantograph by its end
SetLightDimmings(), which the dimmer commands of the cab and the AI's hints call, picked the headlights to put out by iDirection, while RaLightsSet() picks them by the active cab (CabEnd(CabActive)) since the mover became physics::Vehicle. From cab -1 with iDirection > 0 the dimmer put out A and RaLightsSet() B, so both ends went dark. Both now use the end of the active cab: cab 1 the A headlights, cab -1 the B ones, and none without an active cab. This changes behaviour against staging, where RaLightsSet() compared CabActive with the end numbers (0 put out A, 1 put out B, -1 nothing) and SetLightDimmings() went by iDirection. updatePantographMotion() read pantographs[i] by the animation index, past the two ends for a model with more than two pantograph animations (an old fault, staging DynObj.cpp). It reads pantographs[PantographEnd(i)] now, as the voltage and the count of raised pantographs already do.
This commit is contained in:
@@ -162,7 +162,6 @@ void TDynamicObject::RaLightsSet(int head, int rear)
|
||||
|
||||
void TDynamicObject::SetLightDimmings()
|
||||
{
|
||||
auto const vehicleend{iDirection > 0 ? VehicleEnd::front : VehicleEnd::rear};
|
||||
if (Controller == Humandriver)
|
||||
{
|
||||
|
||||
@@ -172,36 +171,22 @@ void TDynamicObject::SetLightDimmings()
|
||||
HighBeamLights = false;
|
||||
DimHeadlights = false;
|
||||
|
||||
// obsługa OFF
|
||||
// obsługa OFF: the headlights at the end of the active cab, as RaLightsSet() picks them: A at the front, B at the
|
||||
// rear, none without an active cab
|
||||
if (dps.isOff)
|
||||
{
|
||||
// physics->iLights[vehicleend] &= 0 | light::rearendsignals; // zostawiamy tylko tabliczki jesli sa
|
||||
HighBeamLights = false;
|
||||
DimHeadlights = false;
|
||||
switch (vehicleend)
|
||||
if (auto const cabend{CabEnd(physics->CabActive)}; cabend.has_value())
|
||||
{
|
||||
case VehicleEnd::front:
|
||||
HeadlightsAoff = true;
|
||||
break;
|
||||
case VehicleEnd::rear:
|
||||
HeadlightsBoff = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
(*cabend == VehicleEnd::front ? HeadlightsAoff : HeadlightsBoff) = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (vehicleend)
|
||||
if (auto const cabend{CabEnd(physics->CabActive)}; cabend.has_value())
|
||||
{
|
||||
case VehicleEnd::front:
|
||||
HeadlightsAoff = false;
|
||||
break;
|
||||
case VehicleEnd::rear:
|
||||
HeadlightsBoff = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
(*cabend == VehicleEnd::front ? HeadlightsAoff : HeadlightsBoff) = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1186,7 +1186,7 @@ void TDynamicObject::updatePantographMotion( int const i, TAnimPant *p, double c
|
||||
pantspeedfactor = std::max( 0.0, pantspeedfactor );
|
||||
k = p->fAngleL;
|
||||
if( pantspeedfactor > 0.0
|
||||
&& physics->pantographs[i].is_active )// jeśli ma być podniesiony
|
||||
&& physics->pantographs[PantographEnd( i )].is_active )// jeśli ma być podniesiony
|
||||
{
|
||||
if (PantDiff > 0.001) // jeśli nie dolega do drutu
|
||||
{ // jeśli poprzednia wysokość jest mniejsza niż pożądana, zwiększyć kąt dolnego
|
||||
|
||||
Reference in New Issue
Block a user