17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-03 19:00:22 +01:00

Do not start a shut down engine on a signal; address SonarCloud findings

A permitting signal no longer wakes a dormant AI: the synthetic departure
command, the shunt-signal ownership tag and the secondary scan that fed
them are gone, and cm_SetVelocity / cm_ShuntVelocity go back to plain
PutCommand with the pre-existing order mask. A secondary now only settles
its own vehicle. Claiming the lead stays for explicit orders.

The rest is SonarCloud cleanup on the branch: if-init statements, merged
and flattened conditionals, split chained assignments, ranges::any_of,
pointer-to-const parameters, std::array for the flag name table and no
more shadowed names.
This commit is contained in:
maj00r
2026-09-14 23:51:20 +02:00
parent a1e4e8d95b
commit e6c2d189ff
5 changed files with 91 additions and 213 deletions

View File

@@ -4479,11 +4479,10 @@ double TMoverParameters::GetDPMainValve(double dt, double hp) const
auto const caboccupied{CabOccupied != 0};
auto const use_handle{
(BrakeOpModes & bom_PS) == 0
|| (caboccupied && BrakeOpModeFlag != bom_PS)};
if (!use_handle)
if (auto const use_handle{
(BrakeOpModes & bom_PS) == 0
|| (caboccupied && BrakeOpModeFlag != bom_PS)};
!use_handle)
{
if (BrakeCtrlPos == Handle->GetPos(bh_EB))
{
@@ -4492,12 +4491,11 @@ double TMoverParameters::GetDPMainValve(double dt, double hp) const
return 0.0;
}
auto const mhzepidle{
BrakeOpModeFlag >= bom_EP
&& BrakeCtrlPosR <= Handle->GetPos(bh_EB) - 0.5
&& (BrakeHandle == TBrakeHandle::MHZ_EN57 || BrakeHandle == TBrakeHandle::MHZ_K8P)};
if (mhzepidle)
if (auto const mhzepidle{
BrakeOpModeFlag >= bom_EP
&& BrakeCtrlPosR <= Handle->GetPos(bh_EB) - 0.5
&& (BrakeHandle == TBrakeHandle::MHZ_EN57 || BrakeHandle == TBrakeHandle::MHZ_K8P)};
mhzepidle)
{
return Handle->GetPF(0, PipePress, hp, dt, EqvtPipePress);
}