18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 08:17:09 +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
+8 -8
View File
@@ -490,7 +490,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this]( float const /*Parameter*/ ) {
return occupied->brakes.config.localKind != TLocalBrake::ManualBrake || occupied->brakes.config.hasHandBrake == false || occupied->brakes.handBrakePosition == ManualBrakePosNo; } );
return occupied->brakes.config.localKind != TLocalBrake::ManualBrake || occupied->brakes.config.hasHandBrake == false || occupied->brakes.HandBrakePosition() == ManualBrakePosNo; } );
break;
}
case driver_hint::manualbrakoff: {
@@ -501,7 +501,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this]( float const /*Parameter*/ ) {
return occupied->brakes.config.localKind != TLocalBrake::ManualBrake || occupied->brakes.config.hasHandBrake == false || occupied->brakes.handBrakePosition == 0; } );
return occupied->brakes.config.localKind != TLocalBrake::ManualBrake || occupied->brakes.config.hasHandBrake == false || occupied->brakes.HandBrakePosition() == 0; } );
break;
}
// master controller
@@ -818,7 +818,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this](float const /*Parameter*/) {
return is_equal(occupied->brakes.handlePositionSmooth, occupied->brakes.driverValve->GetPos(bh_RP), 0.2) || (occupied->brakes.driverValve->Time && occupied->brakes.driverValve->GetCP() > occupied->brakes.config.pipeHighPressure - 0.05); } );
return is_equal(occupied->brakes.HandlePositionSmooth(), occupied->brakes.driverValve->GetPos(bh_RP), 0.2) || (occupied->brakes.driverValve->Time && occupied->brakes.driverValve->GetCP() > occupied->brakes.config.pipeHighPressure - 0.05); } );
// return ( BrakeCtrlPosition == gbh_RP ); } );
break;
}
@@ -867,7 +867,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this](float const Parameter) {
return std::abs(mvControlling->Fb) > Parameter || is_equal(occupied->brakes.handlePositionSmooth, occupied->brakes.driverValve->GetPos(bh_EB), 0.2); },
return std::abs(mvControlling->Fb) > Parameter || is_equal(occupied->brakes.HandlePositionSmooth(), occupied->brakes.driverValve->GetPos(bh_EB), 0.2); },
static_cast<float>(std::max(
0.0,
std::max(
@@ -885,7 +885,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this](float const /*Parameter*/) {
return Ready && fReady < 0.4 && is_equal(occupied->brakes.handlePositionSmooth, occupied->brakes.driverValve->GetPos(bh_RP), 0.2); } );
return Ready && fReady < 0.4 && is_equal(occupied->brakes.HandlePositionSmooth(), occupied->brakes.driverValve->GetPos(bh_RP), 0.2); } );
break;
}
case driver_hint::brakingforcelap: {
@@ -899,7 +899,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
}
// independent brake
case driver_hint::independentbrakeapply: {
if (AIControllFlag && occupied->brakes.independentPosition < 1.0) {
if (AIControllFlag && occupied->brakes.IndependentPosition() < 1.0) {
occupied->IncLocalBrakeLevel( LocalBrakePosNo );
if (occupied->EIMCtrlEmergency) {
occupied->DecLocalBrakeLevel(1);
@@ -909,7 +909,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this](float const Parameter) {
return occupied->brakes.independentPosition >= Parameter; },
return occupied->brakes.IndependentPosition() >= Parameter; },
( LocalBrakePosNo - ( occupied->EIMCtrlEmergency ? 1 : 0 ) ) / LocalBrakePosNo );
break;
}
@@ -921,7 +921,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this](float const /*Parameter*/) {
return occupied->brakes.independentPosition < 0.05; } );
return occupied->brakes.IndependentPosition() < 0.05; } );
break;
}
// reverser