18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-02 14:16:48 +01:00

refactor(physics): the lights, the load and the event flags are private to the vehicle

- The lights switched on at each end (iLights) are LitLights(), changed
  through SetLitLights(): the cab's switches, the AI's light patterns and the
  scenery's toggles of the end signals all go through it.
- The exchange of the load, which TDynamicObject ran by setting the status, the
  amount and the mass itself, goes through UnloadStep(), LoadStep(),
  FinishLoadExchange() and AcknowledgeLoadExchange(), with the same arithmetic;
  the change of the kind of the load is taken once (TakeLoadTypeChange()).
- The events the physics reports for the sounds to follow up are raised and
  cleared by name (RaiseEventFlag(), ClearEventFlag(), ClearSoundFlags()).

No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
This commit is contained in:
2026-11-29 12:33:13 +01:00
parent 84f1aa2515
commit 242474dd11
34 changed files with 331 additions and 286 deletions
+12 -12
View File
@@ -148,7 +148,7 @@ bool physics::Vehicle::IncMainCtrlSeriesMotor(int const CtrlSpeed)
/* NOTE: disabled, relay configuration was moved to compute_movement_
if( true == MaxCurrentSwitch( false )) {
// wylaczanie wysokiego rozruchu
SetFlag( SoundFlag, sound::relay );
SetFlag( soundFlag, sound::relay );
}
*/
if (TrainType == train_type::et42)
@@ -601,7 +601,7 @@ bool physics::Vehicle::AutoRelayShuntStep(bool const ARFASI2)
if (lineContactors.TimeSinceSwitch() > CtrlDelay && ARFASI2)
{
++ScndCtrlActualPos;
SetFlag(SoundFlag, sound::shuntfield);
SetFlag(soundFlag, sound::shuntfield);
OK = true;
}
}
@@ -610,7 +610,7 @@ bool physics::Vehicle::AutoRelayShuntStep(bool const ARFASI2)
if (lineContactors.TimeSinceSwitch() > CtrlDownDelay && TrainType != train_type::emu)
{
--ScndCtrlActualPos;
SetFlag(SoundFlag, sound::shuntfield);
SetFlag(soundFlag, sound::shuntfield);
OK = true;
}
}
@@ -643,7 +643,7 @@ bool physics::Vehicle::AutoRelayMainStep(bool const ARFASI)
if (lineContactors.TimeSinceSwitch() > CtrlDownDelay)
{
--ScndCtrlActualPos; // boczniki nie dzialaja na poz. oporowych
SetFlag(SoundFlag, sound::shuntfield);
SetFlag(soundFlag, sound::shuntfield);
OK = true;
}
}
@@ -677,7 +677,7 @@ bool physics::Vehicle::AutoRelayMainUp(bool const ARFASI)
}
if (RList[MainCtrlActualPos].R == 0)
{
SetFlag(SoundFlag, sound::parallel | sound::loud);
SetFlag(soundFlag, sound::parallel | sound::loud);
OK = true;
}
}
@@ -727,12 +727,12 @@ bool physics::Vehicle::AutoRelayMainNotchUp()
if (RList[MainCtrlActualPos].R == 0 && MainCtrlActualPos != MainCtrlPosNo)
{
// wejscie na bezoporowa
SetFlag(SoundFlag, sound::parallel | sound::loud);
SetFlag(soundFlag, sound::parallel | sound::loud);
}
else if (RList[MainCtrlActualPos].R > 0 && RList[MainCtrlActualPos - 1].R == 0)
{
// wejscie na drugi uklad
SetFlag(SoundFlag, sound::parallel);
SetFlag(soundFlag, sound::parallel);
}
}
return OK;
@@ -750,7 +750,7 @@ bool physics::Vehicle::AutoRelayMainDown()
OK = true;
if (RList[MainCtrlActualPos].R == 0)
{
SetFlag(SoundFlag, sound::parallel);
SetFlag(soundFlag, sound::parallel);
}
}
else if (lineContactors.TimeSinceSwitch() > CtrlDownDelay)
@@ -764,7 +764,7 @@ bool physics::Vehicle::AutoRelayMainDown()
if (MainCtrlActualPos > 0 && RList[MainCtrlActualPos].R == 0)
{
// dzwieki schodzenia z bezoporowej}
SetFlag(SoundFlag, sound::parallel);
SetFlag(soundFlag, sound::parallel);
}
}
return OK;
@@ -784,7 +784,7 @@ bool physics::Vehicle::AutoRelayLineContactorsStep(bool const motorconnectorsoff
lineContactors.Close();
MainCtrlActualPos = 1;
DelayCtrlFlag = false;
SetFlag(SoundFlag, sound::relay | sound::loud);
SetFlag(soundFlag, sound::relay | sound::loud);
OK = true;
}
}
@@ -818,7 +818,7 @@ bool physics::Vehicle::CamshaftRunDown()
if (ScndCtrlActualPos > 0)
{
--ScndCtrlActualPos;
SetFlag(SoundFlag, sound::shuntfield);
SetFlag(soundFlag, sound::shuntfield);
}
else
{
@@ -875,7 +875,7 @@ bool physics::Vehicle::CamshaftRunDownEMU()
{
// potem boki
++ScndCtrlActualPos;
SetFlag(SoundFlag, sound::shuntfield);
SetFlag(soundFlag, sound::shuntfield);
}
else
{