18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-02 20:05:23 +01:00

refactor(physics): the devices out of physics::Vehicle, the pantographs as components

The types of the devices nested in physics::Vehicle (basic_device, the pumps,
the fans, basic_valve, basic_pantograph, basic_door, door_data, water_heater,
genset_device) move out of it into physics/components/devices.h, namespace
physics, so the components of the vehicle can hold them.

The pantographs and their air become components, with English names
(physics/components/pantographs.h):

  Pantographs                 pantographs (ByEnd<basic_pantograph>)
  pantographCircuit           PantFrontVolt / PantRearVolt frontVoltage /
                              rearVoltage, PantographVoltage supplyVoltage,
                              PantAllDown allDown, PantSwitchType switchType,
                              PantsPreset presets
  pantographAir               PantVolume volume, PantPress pressure,
                              PantCompFlag compressorRunning,
                              PantographCompressorStart compressorStart,
                              SmallCompressorPower compressorPower, PantsValve
                              valve, bPantKurek3 connectedToMainReservoir,
                              PantAutoValve autoValve, PantPressSwitchActive /
                              PantPressLockActive pressureSwitchActive /
                              pressureLockActive

No string literal changed (checked over all the changed files).

No change in behaviour: 1149/1149 tests, golden traces exact against staging
62f7a29b.
This commit is contained in:
2026-11-29 02:13:17 +01:00
parent 16568d5695
commit 5e56a91515
32 changed files with 556 additions and 498 deletions
+14 -14
View File
@@ -224,46 +224,46 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
// pantographs
case driver_hint::pantographairsourcesetmain: {
if( AIControllFlag ) {
pantographUnit->bPantKurek3 = true;
pantographUnit->pantographAir.connectedToMainReservoir = true;
}
remove_hint( driver_hint::pantographairsourcesetauxiliary );
hint(
Action,
[this](float const /*Parameter*/) {
return pantographUnit->bPantKurek3 == true; } );
return pantographUnit->pantographAir.connectedToMainReservoir == true; } );
break;
}
case driver_hint::pantographairsourcesetauxiliary: {
if( AIControllFlag ) {
pantographUnit->bPantKurek3 = false;
pantographUnit->pantographAir.connectedToMainReservoir = false;
}
remove_hint( driver_hint::pantographcompressoron );
hint(
Action,
[this](float const /*Parameter*/) {
return pantographUnit->bPantKurek3 == false; } );
return pantographUnit->pantographAir.connectedToMainReservoir == false; } );
break;
}
case driver_hint::pantographcompressoron: {
if( AIControllFlag ) {
pantographUnit->PantCompFlag = true;
pantographUnit->pantographAir.compressorRunning = true;
}
remove_hint( driver_hint::pantographcompressoroff );
hint(
Action,
[this](float const /*Parameter*/) {
return pantographUnit->PantCompFlag == true; } );
return pantographUnit->pantographAir.compressorRunning == true; } );
break;
}
case driver_hint::pantographcompressoroff: {
if( AIControllFlag ) {
pantographUnit->PantCompFlag = false;
pantographUnit->pantographAir.compressorRunning = false;
}
remove_hint( driver_hint::pantographcompressoron );
hint(
Action,
[this](float const /*Parameter*/) {
return pantographUnit->PantCompFlag == false; } );
return pantographUnit->pantographAir.compressorRunning == false; } );
break;
}
case driver_hint::pantographsvalveon: {
@@ -274,7 +274,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this](float const /*Parameter*/) {
return pantographUnit->PantsValve.is_active == true; } );
return pantographUnit->pantographAir.valve.is_active == true; } );
break;
}
case driver_hint::frontpantographvalveon: {
@@ -285,7 +285,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[ this ]( float const Parameter ) {
return pantographUnit->Pantographs[VehicleEnd::front].valve.is_active == true || (Parameter > 0 && occupied->Vel > Parameter); },
return pantographUnit->pantographs[VehicleEnd::front].valve.is_active == true || (Parameter > 0 && occupied->Vel > Parameter); },
Actionparameter );
break;
}
@@ -297,7 +297,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this](float const /*Parameter*/) {
return pantographUnit->Pantographs[VehicleEnd::front].valve.is_active == false; } );
return pantographUnit->pantographs[VehicleEnd::front].valve.is_active == false; } );
break;
}
case driver_hint::rearpantographvalveon: {
@@ -308,7 +308,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[ this ]( float const Parameter ) {
return pantographUnit->Pantographs[VehicleEnd::rear].valve.is_active == true || (Parameter > 0 && occupied->Vel > Parameter); },
return pantographUnit->pantographs[VehicleEnd::rear].valve.is_active == true || (Parameter > 0 && occupied->Vel > Parameter); },
Actionparameter );
break;
}
@@ -320,7 +320,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this](float const /*Parameter*/) {
return pantographUnit->Pantographs[VehicleEnd::rear].valve.is_active == false; } );
return pantographUnit->pantographs[VehicleEnd::rear].valve.is_active == false; } );
break;
}
// converter
@@ -760,7 +760,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this](float const /*Parameter*/) {
return pantographUnit->PantPress >= (is_emu() ? (pantographUnit->PantPressLockActive ? 4.6 : 2.6) : 4.2); } );
return pantographUnit->pantographAir.pressure >= (is_emu() ? (pantographUnit->pantographAir.pressureLockActive ? 4.6 : 2.6) : 4.2); } );
break;
}
case driver_hint::waitbrakecharge: {