18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 12:57:06 +01:00

refactor(physics): the positions of the brake handles are private to the brakes

The positions of the driver's brake valve (stepped, continuous, and of the
FV4a with its cap), of the independent brake and of its EP counterpart in
units with induction motors, and of the hand brake are private to
physics::Braking: read through HandlePosition(), IndependentPosition(), ...
and moved through SetHandlePosition(), SetIndependentPosition(), ..., by the
vehicle's own stepping as by the cab, the AI and the consist braking. The
gauges of the cab bind to them read-only.

No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
This commit is contained in:
2026-11-29 12:38:26 +01:00
parent 242474dd11
commit 0b5459ef7b
39 changed files with 210 additions and 195 deletions
+7 -7
View File
@@ -128,10 +128,10 @@ bool physics::Vehicle::CheckLocomotiveParameters(bool ReadyFlag, int /*Dir*/)
}
ActFlowSpeed = 0.0;
brakes.handlePositionReal = brakes.handlePosition;
brakes.SetHandlePositionReal(brakes.HandlePosition());
if (brakes.config.independentValveType == TBrakeHandle::Knorr)
brakes.independentPosition = 0.5;
brakes.SetIndependentPosition(0.5);
brakePipe.reservoir->CreatePress(brakePipe.Pressure());
mainPipe.reservoir->CreatePress(mainPipe.Pressure());
@@ -424,11 +424,11 @@ void physics::Vehicle::SetReadyToDepart()
mainPipe.SetPressure(InitialScndPipePress(5.0));
brakePipe.SetPressure(brakes.controlReservoirPressure);
brakes.cylinderPressure = 0.0;
brakes.independentPosition = 0.0;
brakes.SetIndependentPosition(0.0);
if (CabActive == 0)
brakes.handlePosition = static_cast<int>(brakes.driverValve->GetPos(bh_NP));
brakes.SetHandlePosition(static_cast<int>(brakes.driverValve->GetPos(bh_NP)));
else
brakes.handlePosition = static_cast<int>(brakes.driverValve->GetPos(bh_RP));
brakes.SetHandlePosition(static_cast<int>(brakes.driverValve->GetPos(bh_RP)));
/*
// NOTE: disabled and left up to the driver, if there's any
MainSwitch( false );
@@ -456,8 +456,8 @@ void physics::Vehicle::SetBraked()
brakePipe.SetPressure(brakes.config.pipeLowPressure);
brakes.pipeCylinderPressure = brakes.config.maxCylinderPressure[3] * 0.5;
brakes.cylinderPressure = brakes.config.maxCylinderPressure[3] * 0.5;
brakes.independentPosition = 0.0;
brakes.handlePosition = static_cast<int>(brakes.driverValve->GetPos(bh_NP));
brakes.SetIndependentPosition(0.0);
brakes.SetHandlePosition(static_cast<int>(brakes.driverValve->GetPos(bh_NP)));
brakes.pipeLimiterPressure = brakes.config.pipeLowPressure;
if (brakes.config.localKind == TLocalBrake::ManualBrake || brakes.config.hasHandBrake == true)
{