mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-01 03:37:09 +01:00
refactor(physics): TMoverParameters becomes physics::Vehicle, the mover is gone
The physics of a vehicle loses the name it had from the Pascal of 2001. Done by
tools/rename/mover_to_physics.py, committed with it:
physics/mover.h physics/vehicle.h
TMoverParameters physics::Vehicle (in namespace physics)
TDynamicObject::MoverParameters physics
mvOccupied, mvControlled occupied, controlled (TTrain, TController)
mvSecond, mvThird secondUnit, thirdUnit
mvPantographUnit pantographUnit
mover, Mover, movers physics, Physics, vehicles (locals, params)
m_mover, othermover, currentMover, from_movers, renderMoverEventSounds
m_physics, otherPhysics, currentPhysics,
from_vehicles, renderPhysicsEventSounds
The code and the comments are renamed, the string literals are not: no text
the game shows, logs or looks up has changed (none had the names). The movers
of the editor, the tracks a slide moves, keep their name.
By hand: two member functions of TDynamicObject (gather_off_track_terrain,
begin_off_track) had a local mover aliasing their own MoverParameters, which
the rename made physics { *physics }; the alias is gone, they use physics->.
No other function has a renamed local meeting a renamed member (checked over
all the functions of the code before the rename).
For the branches made before it: run the script on the branch (python
tools/rename/mover_to_physics.py, from the root of the repository) before
merging it with this one, and the names don't conflict. It can be run again;
the second time it changes nothing.
The class is the same as it was; breaking it into its parts (braking,
electrics, controls, load) and making its data private are the next stages.
No change in behaviour: 1149/1149 tests, golden traces exact against staging
62f7a29b.
This commit is contained in:
+148
-148
@@ -11,7 +11,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "vehicle/Driver.h"
|
||||
#include "utilities/Globals.h"
|
||||
#include "utilities/utilities.h"
|
||||
#include "physics/mover.h"
|
||||
#include "physics/vehicle.h"
|
||||
|
||||
void
|
||||
TController::hint( driver_hint const Value, hintpredicate const Predicate, float const Predicateparameter ) {
|
||||
@@ -83,70 +83,70 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
// battery
|
||||
case driver_hint::batteryon: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->BatterySwitch( true );
|
||||
occupied->BatterySwitch( true );
|
||||
}
|
||||
remove_hint( driver_hint::batteryoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->BatteryStart != start_t::manual || mvOccupied->Power24vIsAvailable == true; } );
|
||||
return occupied->BatteryStart != start_t::manual || occupied->Power24vIsAvailable == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::batteryoff: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->BatterySwitch( false );
|
||||
occupied->BatterySwitch( false );
|
||||
}
|
||||
remove_hint( driver_hint::batteryon );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->BatteryStart != start_t::manual || mvOccupied->Power24vIsAvailable == false; } );
|
||||
return occupied->BatteryStart != start_t::manual || occupied->Power24vIsAvailable == false; } );
|
||||
break;
|
||||
}
|
||||
// battery
|
||||
case driver_hint::cabactivation: {
|
||||
if (AIControllFlag && mvOccupied->Power24vIsAvailable) {
|
||||
mvOccupied->CabActivisation();
|
||||
if (AIControllFlag && occupied->Power24vIsAvailable) {
|
||||
occupied->CabActivisation();
|
||||
CheckVehicles();
|
||||
}
|
||||
remove_hint( driver_hint::cabdeactivation );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->AutomaticCabActivation || mvOccupied->IsCabMaster(); } );
|
||||
return occupied->AutomaticCabActivation || occupied->IsCabMaster(); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::cabdeactivation: {
|
||||
if (AIControllFlag) {
|
||||
mvOccupied->CabDeactivisation();
|
||||
occupied->CabDeactivisation();
|
||||
}
|
||||
remove_hint( driver_hint::cabactivation );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->AutomaticCabActivation || (mvOccupied->CabMaster == false && mvOccupied->CabActive == 0); } );
|
||||
return occupied->AutomaticCabActivation || (occupied->CabMaster == false && occupied->CabActive == 0); } );
|
||||
break;
|
||||
}
|
||||
// radio
|
||||
case driver_hint::radioon: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->Radio = true;
|
||||
occupied->Radio = true;
|
||||
}
|
||||
remove_hint( driver_hint::radiooff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->Radio == true; } );
|
||||
return occupied->Radio == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::radiofuseon: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->RadioFuse = true;
|
||||
occupied->RadioFuse = true;
|
||||
}
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->RadioFuse == true; } );
|
||||
return occupied->RadioFuse == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::radiochannel: {
|
||||
@@ -162,177 +162,177 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
case driver_hint::radiooff: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->Radio = false;
|
||||
occupied->Radio = false;
|
||||
}
|
||||
remove_hint( driver_hint::radioon );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->Radio == false; } );
|
||||
return occupied->Radio == false; } );
|
||||
break;
|
||||
}
|
||||
// oil pump
|
||||
case driver_hint::oilpumpon: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->OilPumpSwitch( true );
|
||||
occupied->OilPumpSwitch( true );
|
||||
}
|
||||
remove_hint( driver_hint::oilpumpoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const &device { mvOccupied->OilPump };
|
||||
return device.start_type != start_t::manual || device.is_enabled == true || device.is_active == true || mvOccupied->Mains; } );
|
||||
auto const &device { occupied->OilPump };
|
||||
return device.start_type != start_t::manual || device.is_enabled == true || device.is_active == true || occupied->Mains; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::oilpumpoff: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->OilPumpSwitch( false );
|
||||
occupied->OilPumpSwitch( false );
|
||||
}
|
||||
remove_hint( driver_hint::oilpumpon );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const &device { mvOccupied->OilPump };
|
||||
auto const &device { occupied->OilPump };
|
||||
return device.start_type != start_t::manual || (device.is_enabled == false && device.is_active == false); } );
|
||||
break;
|
||||
}
|
||||
// fuel pump
|
||||
case driver_hint::fuelpumpon: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->FuelPumpSwitch( true );
|
||||
occupied->FuelPumpSwitch( true );
|
||||
}
|
||||
remove_hint( driver_hint::fuelpumpoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const &device { mvOccupied->FuelPump };
|
||||
auto const &device { occupied->FuelPump };
|
||||
return device.start_type != start_t::manual || device.is_enabled == true || device.is_active == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::fuelpumpoff: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->FuelPumpSwitch( false );
|
||||
occupied->FuelPumpSwitch( false );
|
||||
}
|
||||
remove_hint( driver_hint::fuelpumpon );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const &device { mvOccupied->FuelPump };
|
||||
auto const &device { occupied->FuelPump };
|
||||
return device.start_type != start_t::manual || (device.is_enabled == false && device.is_active == false); } );
|
||||
break;
|
||||
}
|
||||
// pantographs
|
||||
case driver_hint::pantographairsourcesetmain: {
|
||||
if( AIControllFlag ) {
|
||||
mvPantographUnit->bPantKurek3 = true;
|
||||
pantographUnit->bPantKurek3 = true;
|
||||
}
|
||||
remove_hint( driver_hint::pantographairsourcesetauxiliary );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvPantographUnit->bPantKurek3 == true; } );
|
||||
return pantographUnit->bPantKurek3 == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::pantographairsourcesetauxiliary: {
|
||||
if( AIControllFlag ) {
|
||||
mvPantographUnit->bPantKurek3 = false;
|
||||
pantographUnit->bPantKurek3 = false;
|
||||
}
|
||||
remove_hint( driver_hint::pantographcompressoron );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvPantographUnit->bPantKurek3 == false; } );
|
||||
return pantographUnit->bPantKurek3 == false; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::pantographcompressoron: {
|
||||
if( AIControllFlag ) {
|
||||
mvPantographUnit->PantCompFlag = true;
|
||||
pantographUnit->PantCompFlag = true;
|
||||
}
|
||||
remove_hint( driver_hint::pantographcompressoroff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvPantographUnit->PantCompFlag == true; } );
|
||||
return pantographUnit->PantCompFlag == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::pantographcompressoroff: {
|
||||
if( AIControllFlag ) {
|
||||
mvPantographUnit->PantCompFlag = false;
|
||||
pantographUnit->PantCompFlag = false;
|
||||
}
|
||||
remove_hint( driver_hint::pantographcompressoron );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvPantographUnit->PantCompFlag == false; } );
|
||||
return pantographUnit->PantCompFlag == false; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::pantographsvalveon: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->OperatePantographsValve( operation_t::enable );
|
||||
occupied->OperatePantographsValve( operation_t::enable );
|
||||
}
|
||||
remove_hint( driver_hint::pantographsvalveoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvPantographUnit->PantsValve.is_active == true; } );
|
||||
return pantographUnit->PantsValve.is_active == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::frontpantographvalveon: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->OperatePantographValve( VehicleEnd::front, operation_t::enable );
|
||||
occupied->OperatePantographValve( VehicleEnd::front, operation_t::enable );
|
||||
}
|
||||
remove_hint( driver_hint::frontpantographvalveoff );
|
||||
hint(
|
||||
Action,
|
||||
[ this ]( float const Parameter ) {
|
||||
return mvPantographUnit->Pantographs[VehicleEnd::front].valve.is_active == true || (Parameter > 0 && mvOccupied->Vel > Parameter); },
|
||||
return pantographUnit->Pantographs[VehicleEnd::front].valve.is_active == true || (Parameter > 0 && occupied->Vel > Parameter); },
|
||||
Actionparameter );
|
||||
break;
|
||||
}
|
||||
case driver_hint::frontpantographvalveoff: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->OperatePantographValve( VehicleEnd::front, operation_t::disable );
|
||||
occupied->OperatePantographValve( VehicleEnd::front, operation_t::disable );
|
||||
}
|
||||
remove_hint( driver_hint::frontpantographvalveon );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvPantographUnit->Pantographs[VehicleEnd::front].valve.is_active == false; } );
|
||||
return pantographUnit->Pantographs[VehicleEnd::front].valve.is_active == false; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::rearpantographvalveon: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->OperatePantographValve( VehicleEnd::rear, operation_t::enable );
|
||||
occupied->OperatePantographValve( VehicleEnd::rear, operation_t::enable );
|
||||
}
|
||||
remove_hint( driver_hint::rearpantographvalveoff );
|
||||
hint(
|
||||
Action,
|
||||
[ this ]( float const Parameter ) {
|
||||
return mvPantographUnit->Pantographs[VehicleEnd::rear].valve.is_active == true || (Parameter > 0 && mvOccupied->Vel > Parameter); },
|
||||
return pantographUnit->Pantographs[VehicleEnd::rear].valve.is_active == true || (Parameter > 0 && occupied->Vel > Parameter); },
|
||||
Actionparameter );
|
||||
break;
|
||||
}
|
||||
case driver_hint::rearpantographvalveoff: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->OperatePantographValve( VehicleEnd::rear, operation_t::disable );
|
||||
occupied->OperatePantographValve( VehicleEnd::rear, operation_t::disable );
|
||||
}
|
||||
remove_hint( driver_hint::rearpantographvalveon );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvPantographUnit->Pantographs[VehicleEnd::rear].valve.is_active == false; } );
|
||||
return pantographUnit->Pantographs[VehicleEnd::rear].valve.is_active == false; } );
|
||||
break;
|
||||
}
|
||||
// converter
|
||||
case driver_hint::converteron: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->ConverterSwitch( true );
|
||||
occupied->ConverterSwitch( true );
|
||||
// the local switch of the converter too, where the line contactors wait for the vehicle's own converter
|
||||
// (LineContactorsInterlock): left off by the human driver, that vehicle would never take power
|
||||
pVehicle->for_each(
|
||||
Coupling::control,
|
||||
[]( TDynamicObject * Vehicle ) {
|
||||
auto *vehicle { Vehicle->MoverParameters };
|
||||
auto *vehicle { Vehicle->physics };
|
||||
if( vehicle->LineContactorsHeldByLocalConverterSwitch() ) {
|
||||
vehicle->ConverterAllowLocal = true; } } );
|
||||
}
|
||||
@@ -345,7 +345,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
case driver_hint::converteroff: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->ConverterSwitch( false );
|
||||
occupied->ConverterSwitch( false );
|
||||
}
|
||||
remove_hint( driver_hint::converteron );
|
||||
hint(
|
||||
@@ -357,38 +357,38 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
// relays
|
||||
case driver_hint::primaryconverteroverloadreset: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->RelayReset( relay_t::primaryconverteroverload );
|
||||
occupied->RelayReset( relay_t::primaryconverteroverload );
|
||||
}
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->ConverterOverloadRelayStart != start_t::manual || mvOccupied->ConvOvldFlag == false; } );
|
||||
return occupied->ConverterOverloadRelayStart != start_t::manual || occupied->ConvOvldFlag == false; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::maincircuitgroundreset: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->RelayReset( relay_t::maincircuitground );
|
||||
occupied->RelayReset( relay_t::maincircuitground );
|
||||
}
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->GroundRelayStart != start_t::manual || mvOccupied->GroundRelay == true; } );
|
||||
return occupied->GroundRelayStart != start_t::manual || occupied->GroundRelay == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::tractionnmotoroverloadreset: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->RelayReset( relay_t::tractionnmotoroverload );
|
||||
occupied->RelayReset( relay_t::tractionnmotoroverload );
|
||||
}
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->FuseFlag == false; } );
|
||||
return occupied->FuseFlag == false; } );
|
||||
break;
|
||||
}
|
||||
// line breaker
|
||||
case driver_hint::linebreakerclose: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->MainSwitch( true );
|
||||
occupied->MainSwitch( true );
|
||||
}
|
||||
remove_hint( driver_hint::linebreakeropen );
|
||||
hint(
|
||||
@@ -399,7 +399,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
case driver_hint::linebreakeropen: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->MainSwitch( false );
|
||||
occupied->MainSwitch( false );
|
||||
}
|
||||
remove_hint( driver_hint::linebreakerclose );
|
||||
hint(
|
||||
@@ -412,7 +412,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
// compressor
|
||||
case driver_hint::compressoron: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->CompressorSwitch( true );
|
||||
occupied->CompressorSwitch( true );
|
||||
}
|
||||
remove_hint( driver_hint::compressoroff );
|
||||
hint(
|
||||
@@ -423,7 +423,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
case driver_hint::compressoroff: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->CompressorSwitch( false );
|
||||
occupied->CompressorSwitch( false );
|
||||
}
|
||||
remove_hint( driver_hint::compressoron );
|
||||
hint(
|
||||
@@ -434,74 +434,74 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
case driver_hint::frontmotorblowerson: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->MotorBlowersSwitchOff( false, VehicleEnd::front );
|
||||
mvOccupied->MotorBlowersSwitch( true, VehicleEnd::front );
|
||||
occupied->MotorBlowersSwitchOff( false, VehicleEnd::front );
|
||||
occupied->MotorBlowersSwitch( true, VehicleEnd::front );
|
||||
}
|
||||
remove_hint( driver_hint::frontmotorblowersoff );
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const /*Parameter*/ ) {
|
||||
auto const &device { mvOccupied->MotorBlowers[ VehicleEnd::front ] };
|
||||
auto const &device { occupied->MotorBlowers[ VehicleEnd::front ] };
|
||||
return device.start_type != start_t::manual || (device.is_enabled == true && device.is_disabled == false); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::rearmotorblowerson: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->MotorBlowersSwitchOff( false, VehicleEnd::rear );
|
||||
mvOccupied->MotorBlowersSwitch( true, VehicleEnd::rear );
|
||||
occupied->MotorBlowersSwitchOff( false, VehicleEnd::rear );
|
||||
occupied->MotorBlowersSwitch( true, VehicleEnd::rear );
|
||||
}
|
||||
remove_hint( driver_hint::rearmotorblowersoff );
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const /*Parameter*/ ) {
|
||||
auto const &device { mvOccupied->MotorBlowers[ VehicleEnd::rear ] };
|
||||
auto const &device { occupied->MotorBlowers[ VehicleEnd::rear ] };
|
||||
return device.start_type != start_t::manual || (device.is_enabled == true && device.is_disabled == false); } );
|
||||
break;
|
||||
}
|
||||
// spring brake
|
||||
case driver_hint::springbrakeon: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->SpringBrakeActivate( true );
|
||||
occupied->SpringBrakeActivate( true );
|
||||
}
|
||||
remove_hint( driver_hint::springbrakeoff );
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const /*Parameter*/ ) {
|
||||
return mvOccupied->SpringBrake.Activate == true; } );
|
||||
return occupied->SpringBrake.Activate == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::springbrakeoff: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->SpringBrakeActivate( false );
|
||||
occupied->SpringBrakeActivate( false );
|
||||
}
|
||||
remove_hint( driver_hint::springbrakeon );
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const /*Parameter*/ ) {
|
||||
return mvOccupied->SpringBrake.Activate == false; } );
|
||||
return occupied->SpringBrake.Activate == false; } );
|
||||
break;
|
||||
}
|
||||
// manual brake
|
||||
case driver_hint::manualbrakon: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->IncManualBrakeLevel( ManualBrakePosNo );
|
||||
occupied->IncManualBrakeLevel( ManualBrakePosNo );
|
||||
}
|
||||
remove_hint( driver_hint::manualbrakoff );
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const /*Parameter*/ ) {
|
||||
return mvOccupied->LocalBrake != TLocalBrake::ManualBrake || mvOccupied->MBrake == false || mvOccupied->ManualBrakePos == ManualBrakePosNo; } );
|
||||
return occupied->LocalBrake != TLocalBrake::ManualBrake || occupied->MBrake == false || occupied->ManualBrakePos == ManualBrakePosNo; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::manualbrakoff: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->DecManualBrakeLevel( ManualBrakePosNo );
|
||||
occupied->DecManualBrakeLevel( ManualBrakePosNo );
|
||||
}
|
||||
remove_hint( driver_hint::manualbrakon );
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const /*Parameter*/ ) {
|
||||
return mvOccupied->LocalBrake != TLocalBrake::ManualBrake || mvOccupied->MBrake == false || mvOccupied->ManualBrakePos == 0; } );
|
||||
return occupied->LocalBrake != TLocalBrake::ManualBrake || occupied->MBrake == false || occupied->ManualBrakePos == 0; } );
|
||||
break;
|
||||
}
|
||||
// master controller
|
||||
@@ -593,8 +593,8 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return AccDesired <= EU07_AI_NOACCELERATION || (false == Ready && false == mvOccupied->ShuntMode) || AccDesired - AbsAccS <= 0.05 ||
|
||||
(mvOccupied->EIMCtrlType > 0 ? mvControlling->eimic_real >= 1.0 : mvControlling->IsScndCtrlMaxPowerPos() && mvControlling->IsMainCtrlMaxPowerPos()); } );
|
||||
return AccDesired <= EU07_AI_NOACCELERATION || (false == Ready && false == occupied->ShuntMode) || AccDesired - AbsAccS <= 0.05 ||
|
||||
(occupied->EIMCtrlType > 0 ? mvControlling->eimic_real >= 1.0 : mvControlling->IsScndCtrlMaxPowerPos() && mvControlling->IsMainCtrlMaxPowerPos()); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::bufferscompress: {
|
||||
@@ -760,7 +760,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvPantographUnit->PantPress >= (is_emu() ? (mvPantographUnit->PantPressLockActive ? 4.6 : 2.6) : 4.2); } );
|
||||
return pantographUnit->PantPress >= (is_emu() ? (pantographUnit->PantPressLockActive ? 4.6 : 2.6) : 4.2); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::waitbrakecharge: {
|
||||
@@ -796,8 +796,8 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
// driver_hint_brakingforcesetzero
|
||||
// driver_hint_brakingforcelap
|
||||
case driver_hint::trainbrakesetpipeunlock: {
|
||||
if (AIControllFlag && mvOccupied->HandleUnlock != -3) {
|
||||
while( BrakeCtrlPosition >= mvOccupied->HandleUnlock
|
||||
if (AIControllFlag && occupied->HandleUnlock != -3) {
|
||||
while( BrakeCtrlPosition >= occupied->HandleUnlock
|
||||
&& BrakeLevelAdd(-1) ) {
|
||||
// all work is done in the header
|
||||
}
|
||||
@@ -806,19 +806,19 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->HandleUnlock == -3 || BrakeCtrlPosition == mvOccupied->HandleUnlock; } );
|
||||
return occupied->HandleUnlock == -3 || BrakeCtrlPosition == occupied->HandleUnlock; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::trainbrakerelease: {
|
||||
if( AIControllFlag ) {
|
||||
// mvOccupied->BrakeLevelSet( mvOccupied->Handle->GetPos( bh_RP ) );
|
||||
// occupied->BrakeLevelSet( occupied->Handle->GetPos( bh_RP ) );
|
||||
BrakeLevelSet( gbh_RP );
|
||||
}
|
||||
remove_train_brake_hints();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return is_equal(mvOccupied->fBrakeCtrlPos, mvOccupied->Handle->GetPos(bh_RP), 0.2) || (mvOccupied->Handle->Time && mvOccupied->Handle->GetCP() > mvOccupied->HighPipePress - 0.05); } );
|
||||
return is_equal(occupied->fBrakeCtrlPos, occupied->Handle->GetPos(bh_RP), 0.2) || (occupied->Handle->Time && occupied->Handle->GetCP() > occupied->HighPipePress - 0.05); } );
|
||||
// return ( BrakeCtrlPosition == gbh_RP ); } );
|
||||
break;
|
||||
}
|
||||
@@ -826,7 +826,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
if( AIControllFlag ) {
|
||||
// za radą yB ustawiamy pozycję 3 kranu (ruszanie kranem w innych miejscach powino zostać wyłączone)
|
||||
if( BrakeSystem == TBrakeSystem::ElectroPneumatic && false == ForcePNBrake ) {
|
||||
mvOccupied->BrakeLevelSet( mvOccupied->Handle->GetPos( bh_EPB ) );
|
||||
occupied->BrakeLevelSet( occupied->Handle->GetPos( bh_EPB ) );
|
||||
}
|
||||
else {
|
||||
BrakeCtrlPosition = 3;
|
||||
@@ -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(mvOccupied->fBrakeCtrlPos, mvOccupied->Handle->GetPos(bh_EB), 0.2); },
|
||||
return std::abs(mvControlling->Fb) > Parameter || is_equal(occupied->fBrakeCtrlPos, occupied->Handle->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(mvOccupied->fBrakeCtrlPos, mvOccupied->Handle->GetPos(bh_RP), 0.2); } );
|
||||
return Ready && fReady < 0.4 && is_equal(occupied->fBrakeCtrlPos, occupied->Handle->GetPos(bh_RP), 0.2); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::brakingforcelap: {
|
||||
@@ -899,18 +899,18 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// independent brake
|
||||
case driver_hint::independentbrakeapply: {
|
||||
if (AIControllFlag && mvOccupied->LocalBrakePosA < 1.0) {
|
||||
mvOccupied->IncLocalBrakeLevel( LocalBrakePosNo );
|
||||
if (mvOccupied->EIMCtrlEmergency) {
|
||||
mvOccupied->DecLocalBrakeLevel(1);
|
||||
if (AIControllFlag && occupied->LocalBrakePosA < 1.0) {
|
||||
occupied->IncLocalBrakeLevel( LocalBrakePosNo );
|
||||
if (occupied->EIMCtrlEmergency) {
|
||||
occupied->DecLocalBrakeLevel(1);
|
||||
}
|
||||
}
|
||||
remove_hint( driver_hint::independentbrakerelease );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) {
|
||||
return mvOccupied->LocalBrakePosA >= Parameter; },
|
||||
( LocalBrakePosNo - ( mvOccupied->EIMCtrlEmergency ? 1 : 0 ) ) / LocalBrakePosNo );
|
||||
return occupied->LocalBrakePosA >= Parameter; },
|
||||
( LocalBrakePosNo - ( occupied->EIMCtrlEmergency ? 1 : 0 ) ) / LocalBrakePosNo );
|
||||
break;
|
||||
}
|
||||
case driver_hint::independentbrakerelease: {
|
||||
@@ -921,36 +921,36 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->LocalBrakePosA < 0.05; } );
|
||||
return occupied->LocalBrakePosA < 0.05; } );
|
||||
break;
|
||||
}
|
||||
// reverser
|
||||
case driver_hint::directionforward: {
|
||||
if( AIControllFlag ) {
|
||||
OrderDirectionChange( 1, mvOccupied );
|
||||
OrderDirectionChange( 1, occupied );
|
||||
}
|
||||
remove_reverser_hints();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->DirActive * mvOccupied->CabActive > 0; } );
|
||||
return occupied->DirActive * occupied->CabActive > 0; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::directionbackward: {
|
||||
if( AIControllFlag ) {
|
||||
OrderDirectionChange( -1, mvOccupied );
|
||||
OrderDirectionChange( -1, occupied );
|
||||
}
|
||||
remove_reverser_hints();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->DirActive * mvOccupied->CabActive < 0; } );
|
||||
return occupied->DirActive * occupied->CabActive < 0; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::directionother: {
|
||||
if( AIControllFlag ) {
|
||||
// DirectionForward( mvOccupied->DirAbsolute < 0 );
|
||||
OrderDirectionChange( iDirectionOrder, mvOccupied );
|
||||
// DirectionForward( occupied->DirAbsolute < 0 );
|
||||
OrderDirectionChange( iDirectionOrder, occupied );
|
||||
DirectionChange();
|
||||
}
|
||||
remove_reverser_hints();
|
||||
@@ -968,7 +968,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->DirActive == 0; } );
|
||||
return occupied->DirActive == 0; } );
|
||||
break;
|
||||
}
|
||||
// anti-slip systems
|
||||
@@ -1007,19 +1007,19 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
// horns
|
||||
case driver_hint::hornon: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->WarningSignal = static_cast<int>( Actionparameter );
|
||||
occupied->WarningSignal = static_cast<int>( Actionparameter );
|
||||
}
|
||||
remove_hint( driver_hint::hornoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
// NOTE: we provide slightly larger horn activation window for human driver
|
||||
return fWarningDuration + 5.0 < 0.05 || mvOccupied->WarningSignal != 0; } );
|
||||
return fWarningDuration + 5.0 < 0.05 || occupied->WarningSignal != 0; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::hornoff: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->WarningSignal = 0;
|
||||
occupied->WarningSignal = 0;
|
||||
}
|
||||
/*
|
||||
// NOTE: for human driver the hint to switch horn on will disappear automatically
|
||||
@@ -1027,50 +1027,50 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvOccupied->WarningSignal == 0 ); } );
|
||||
return ( occupied->WarningSignal == 0 ); } );
|
||||
*/
|
||||
break;
|
||||
}
|
||||
// door locks
|
||||
case driver_hint::consistdoorlockson: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->LockDoors( true );
|
||||
occupied->LockDoors( true );
|
||||
}
|
||||
// TODO: remove other door lock hints
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->Doors.has_lock == false || mvOccupied->Doors.lock_enabled == true; } );
|
||||
return occupied->Doors.has_lock == false || occupied->Doors.lock_enabled == true; } );
|
||||
break;
|
||||
}
|
||||
// departure signal
|
||||
case driver_hint::departuresignalon: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->signal_departure( true );
|
||||
occupied->signal_departure( true );
|
||||
}
|
||||
remove_hint( driver_hint::departuresignaloff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->Doors.has_warning == false || mvOccupied->Doors.has_autowarning == true || mvOccupied->DepartureSignal == true || mvOccupied->Vel > 5.0; } );
|
||||
return occupied->Doors.has_warning == false || occupied->Doors.has_autowarning == true || occupied->DepartureSignal == true || occupied->Vel > 5.0; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::departuresignaloff: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->signal_departure( false );
|
||||
occupied->signal_departure( false );
|
||||
}
|
||||
remove_hint( driver_hint::departuresignalon );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->Doors.has_warning == false || mvOccupied->Doors.has_autowarning == true || mvOccupied->DepartureSignal == false; } );
|
||||
return occupied->Doors.has_warning == false || occupied->Doors.has_autowarning == true || occupied->DepartureSignal == false; } );
|
||||
break;
|
||||
}
|
||||
// consist doors
|
||||
case driver_hint::doorrightopen: {
|
||||
if( AIControllFlag
|
||||
|| pVehicle->MoverParameters->Doors.open_control == control_t::conductor ) {
|
||||
pVehicle->MoverParameters->OperateDoors( VehicleSide::right, true );
|
||||
|| pVehicle->physics->Doors.open_control == control_t::conductor ) {
|
||||
pVehicle->physics->OperateDoors( VehicleSide::right, true );
|
||||
}
|
||||
remove_hint( driver_hint::doorrightclose );
|
||||
hint(
|
||||
@@ -1081,8 +1081,8 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
case driver_hint::doorrightclose: {
|
||||
if( AIControllFlag
|
||||
|| pVehicle->MoverParameters->Doors.open_control == control_t::conductor ) {
|
||||
pVehicle->MoverParameters->OperateDoors( VehicleSide::right, false );
|
||||
|| pVehicle->physics->Doors.open_control == control_t::conductor ) {
|
||||
pVehicle->physics->OperateDoors( VehicleSide::right, false );
|
||||
}
|
||||
remove_hint( driver_hint::doorrightopen );
|
||||
hint(
|
||||
@@ -1093,8 +1093,8 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
case driver_hint::doorleftopen: {
|
||||
if( AIControllFlag
|
||||
|| pVehicle->MoverParameters->Doors.open_control == control_t::conductor ) {
|
||||
pVehicle->MoverParameters->OperateDoors( VehicleSide::left, true );
|
||||
|| pVehicle->physics->Doors.open_control == control_t::conductor ) {
|
||||
pVehicle->physics->OperateDoors( VehicleSide::left, true );
|
||||
}
|
||||
remove_hint( driver_hint::doorleftclose );
|
||||
hint(
|
||||
@@ -1105,8 +1105,8 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
case driver_hint::doorleftclose: {
|
||||
if( AIControllFlag
|
||||
|| pVehicle->MoverParameters->Doors.open_control == control_t::conductor ) {
|
||||
pVehicle->MoverParameters->OperateDoors( VehicleSide::left, false );
|
||||
|| pVehicle->physics->Doors.open_control == control_t::conductor ) {
|
||||
pVehicle->physics->OperateDoors( VehicleSide::left, false );
|
||||
}
|
||||
remove_hint( driver_hint::doorleftopen );
|
||||
hint(
|
||||
@@ -1117,7 +1117,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
case driver_hint::doorrightpermiton: {
|
||||
if( AIControllFlag ) {
|
||||
pVehicle->MoverParameters->PermitDoors( VehicleSide::right, true );
|
||||
pVehicle->physics->PermitDoors( VehicleSide::right, true );
|
||||
}
|
||||
remove_hint( driver_hint::doorrightpermitoff );
|
||||
hint(
|
||||
@@ -1128,7 +1128,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
case driver_hint::doorrightpermitoff: {
|
||||
if( AIControllFlag ) {
|
||||
pVehicle->MoverParameters->PermitDoors( VehicleSide::right, false );
|
||||
pVehicle->physics->PermitDoors( VehicleSide::right, false );
|
||||
}
|
||||
remove_hint( driver_hint::doorrightpermiton );
|
||||
hint(
|
||||
@@ -1139,7 +1139,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
case driver_hint::doorleftpermiton: {
|
||||
if( AIControllFlag ) {
|
||||
pVehicle->MoverParameters->PermitDoors( VehicleSide::left, true );
|
||||
pVehicle->physics->PermitDoors( VehicleSide::left, true );
|
||||
}
|
||||
remove_hint( driver_hint::doorleftpermitoff );
|
||||
hint(
|
||||
@@ -1150,7 +1150,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
case driver_hint::doorleftpermitoff: {
|
||||
if( AIControllFlag ) {
|
||||
pVehicle->MoverParameters->PermitDoors( VehicleSide::left, false );
|
||||
pVehicle->physics->PermitDoors( VehicleSide::left, false );
|
||||
}
|
||||
remove_hint( driver_hint::doorleftpermiton );
|
||||
hint(
|
||||
@@ -1162,93 +1162,93 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
// doorsteps, as the timetable asks (eu07/maszyna#95)
|
||||
case driver_hint::doorstepon: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->PermitDoorStep( true );
|
||||
occupied->PermitDoorStep( true );
|
||||
}
|
||||
remove_hint( driver_hint::doorstepoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->Doors.step_enabled == true; } );
|
||||
return occupied->Doors.step_enabled == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::doorstepoff: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->PermitDoorStep( false );
|
||||
occupied->PermitDoorStep( false );
|
||||
}
|
||||
remove_hint( driver_hint::doorstepon );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->Doors.step_enabled == false; } );
|
||||
return occupied->Doors.step_enabled == false; } );
|
||||
break;
|
||||
}
|
||||
// consist lights
|
||||
case driver_hint::consistlightson: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->CompartmentLightsSwitch( true );
|
||||
mvOccupied->CompartmentLightsSwitchOff( false );
|
||||
occupied->CompartmentLightsSwitch( true );
|
||||
occupied->CompartmentLightsSwitchOff( false );
|
||||
}
|
||||
remove_hint( driver_hint::consistlightsoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const &device { mvOccupied->CompartmentLights };
|
||||
auto const &device { occupied->CompartmentLights };
|
||||
return Global.fLuminance * ConsistShade > 0.40 || device.start_type != start_t::manual || (device.is_enabled == true && device.is_disabled == false) || device.is_active == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::consistlightsoff: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->CompartmentLightsSwitch( false );
|
||||
mvOccupied->CompartmentLightsSwitchOff( true );
|
||||
occupied->CompartmentLightsSwitch( false );
|
||||
occupied->CompartmentLightsSwitchOff( true );
|
||||
}
|
||||
remove_hint( driver_hint::consistlightson );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const &device { mvOccupied->CompartmentLights };
|
||||
auto const &device { occupied->CompartmentLights };
|
||||
return Global.fLuminance * ConsistShade < 0.35 || device.start_type != start_t::manual || (device.is_enabled == false && device.is_active == false); } );
|
||||
break;
|
||||
}
|
||||
// consist heating
|
||||
case driver_hint::consistheatingon: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->HeatingSwitch( true );
|
||||
occupied->HeatingSwitch( true );
|
||||
}
|
||||
remove_hint( driver_hint::consistheatingoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->HeatingAllow == true; } );
|
||||
return occupied->HeatingAllow == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::consistheatingoff: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->HeatingSwitch( false );
|
||||
occupied->HeatingSwitch( false );
|
||||
}
|
||||
remove_hint( driver_hint::consistheatingon );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->HeatingAllow == false; } );
|
||||
return occupied->HeatingAllow == false; } );
|
||||
break;
|
||||
}
|
||||
|
||||
case driver_hint::securitysystemreset: {
|
||||
if (AIControllFlag && mvOccupied->SecuritySystem.is_blinking())
|
||||
mvOccupied->SecuritySystemReset();
|
||||
if (AIControllFlag && occupied->SecuritySystem.is_blinking())
|
||||
occupied->SecuritySystemReset();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return !mvOccupied->SecuritySystem.is_vigilance_blinking(); } );
|
||||
return !occupied->SecuritySystem.is_vigilance_blinking(); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::shpsystemreset: {
|
||||
if (AIControllFlag && mvOccupied->SecuritySystem.is_cabsignal_blinking())
|
||||
mvOccupied->SecuritySystem.cabsignal_reset();
|
||||
if (AIControllFlag && occupied->SecuritySystem.is_cabsignal_blinking())
|
||||
occupied->SecuritySystem.cabsignal_reset();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return !mvOccupied->SecuritySystem.is_cabsignal_blinking(); } );
|
||||
return !occupied->SecuritySystem.is_cabsignal_blinking(); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::couplingadapterattach: {
|
||||
@@ -1259,7 +1259,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) {
|
||||
auto const &device { pVehicles[ VehicleEnd::front ]->MoverParameters->Couplers[ static_cast<int>( Parameter ) ] };
|
||||
auto const &device { pVehicles[ VehicleEnd::front ]->physics->Couplers[ static_cast<int>( Parameter ) ] };
|
||||
return device.type() == TCouplerType::Automatic; } );
|
||||
break;
|
||||
}
|
||||
@@ -1270,7 +1270,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) {
|
||||
auto const &device { pVehicles[ VehicleEnd::front ]->MoverParameters->Couplers[ static_cast<int>( Parameter ) ] };
|
||||
auto const &device { pVehicles[ VehicleEnd::front ]->physics->Couplers[ static_cast<int>( Parameter ) ] };
|
||||
return false == device.has_adapter(); } );
|
||||
break;
|
||||
}
|
||||
@@ -1305,7 +1305,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
// HACK: the 'front' and 'rear' of the consist is determined by current consist direction
|
||||
// since direction shouldn't affect Tb1 light configuration, we 'counter' this behaviour by virtually swapping end vehicles
|
||||
if( AIControllFlag ) {
|
||||
if( mvOccupied->DirActive >= 0 ) { Lights( light::headlight_right, light::headlight_left ); }
|
||||
if( occupied->DirActive >= 0 ) { Lights( light::headlight_right, light::headlight_left ); }
|
||||
else { Lights( light::headlight_left, light::headlight_right ); }
|
||||
}
|
||||
remove_hint( driver_hint::headcodepc1 );
|
||||
@@ -1315,8 +1315,8 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const activeend { mvOccupied->CabActive >= 0 ? VehicleEnd::front : VehicleEnd::rear };
|
||||
auto const consistfront { mvOccupied->DirActive >= 0 ? VehicleEnd::front : VehicleEnd::rear };
|
||||
auto const activeend { occupied->CabActive >= 0 ? VehicleEnd::front : VehicleEnd::rear };
|
||||
auto const consistfront { occupied->DirActive >= 0 ? VehicleEnd::front : VehicleEnd::rear };
|
||||
return pVehicles[consistfront]->has_signal_on(activeend, light::headlight_right) && pVehicles[Opposite(consistfront)]->has_signal_on(Opposite(activeend), light::headlight_left); } );
|
||||
break;
|
||||
}
|
||||
@@ -1344,32 +1344,32 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const activeend { mvOccupied->CabActive >= 0 ? VehicleEnd::front : VehicleEnd::rear };
|
||||
auto const consistfront { mvOccupied->DirActive >= 0 ? VehicleEnd::front : VehicleEnd::rear };
|
||||
auto const activeend { occupied->CabActive >= 0 ? VehicleEnd::front : VehicleEnd::rear };
|
||||
auto const consistfront { occupied->DirActive >= 0 ? VehicleEnd::front : VehicleEnd::rear };
|
||||
return pVehicles[consistfront]->has_signal_on(activeend, 0) && pVehicles[Opposite(consistfront)]->has_signal_on(Opposite(activeend), 0); } );
|
||||
break;
|
||||
}
|
||||
// releaser
|
||||
case driver_hint::releaseron: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->BrakeReleaser( 1 );
|
||||
occupied->BrakeReleaser( 1 );
|
||||
}
|
||||
remove_hint( driver_hint::releaseroff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return true == mvOccupied->Hamulec->Releaser(); } );
|
||||
return true == occupied->Hamulec->Releaser(); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::releaseroff: {
|
||||
if( AIControllFlag ) {
|
||||
mvOccupied->BrakeReleaser( 0 );
|
||||
occupied->BrakeReleaser( 0 );
|
||||
}
|
||||
remove_hint( driver_hint::releaseron );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return false == mvOccupied->Hamulec->Releaser(); } );
|
||||
return false == occupied->Hamulec->Releaser(); } );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user