mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 05:09:20 +02:00
Fix/sonar maintainability rebased (#209)
* refactor(sonar): use override instead of redundant virtual (cpp:S3471) * refactor(sonar): remove empty statements, one declaration per statement (cpp:S1116, cpp:S1659) * refactor(sonar): drop redundant lambda return types (cpp:S3574) * refactor(sonar): prefer using over typedef (cpp:S5416) * refactor(sonar): use =default for trivial special members (cpp:S3490) * refactor(sonar): use nullptr literal (cpp:S4962) * refactor(sonar): remove redundant access specifiers (cpp:S3539) * refactor(sonar): remove redundant casts (cpp:S1905) * refactor(sonar): use std::scoped_lock instead of std::lock_guard (cpp:S5997) * refactor(sonar): construct elements in place with emplace_back (cpp:S6003) * refactor(sonar): make narrowing conversions explicit (cpp:S5276) * refactor(sonar): mark unused parameters (cpp:S1172) Unused names are commented out; parameters used only on some platforms are marked [[maybe_unused]]. * refactor(sonar): declare non-mutating member functions const (cpp:S5817) Virtual functions are left untouched so overrides keep matching. * refactor(sonar): merge collapsible nested if statements (cpp:S1066) Comments that preceded the inner if are kept above the merged statement. * refactor(sonar): scope single-use variables in if init-statements (cpp:S6004) * fix(sonar): give polymorphic base classes virtual destructors (cpp:S1235) * refactor(sonar): use try_emplace for map insertion (cpp:S6030) * refactor(sonar): use auto where the type is spelled out on the right (cpp:S5827) * refactor(sonar): remove redundant parentheses (cpp:S1110) * refactor(sonar): document intentionally empty functions (cpp:S1186) * refactor(sonar): remove dead stores (cpp:S1854) Side effects (e.g. LISTLINE++) are kept. * refactor(sonar): remove unused variables, captures and private fields (cpp:S1481, cpp:S1068) * refactor(sonar): use structured bindings for pair access (cpp:S6005) * refactor(sonar): use range-based loops and ranges algorithms (cpp:S5566) * refactor(sonar): split chained assignments (cpp:S1121) * refactor(sonar): add default cases to switch statements (cpp:S3562) * refactor(sonar): use std::size for array lengths (cpp:S7127) * refactor(sonar): use std::ranges algorithms and std::erase(_if) (cpp:S6197) * refactor(sonar): access static members through the class (cpp:S2209) * refactor(sonar): add braces around nested if-else (cpp:S5261) * refactor(sonar): avoid side effects inside typeid operands (cpp:S5279) * refactor(sonar): drop top-level const from by-value return types (cpp:S5951) * refactor(sonar): declare variables separately from their type definitions (cpp:S3646) * refactor(sonar): declare loop counters in the for statement (cpp:S5955) * refactor(sonar): rely on class template argument deduction (cpp:S6012) * refactor(sonar): inherit base constructors instead of forwarding them (cpp:S5952) * refactor(sonar): rename locals that shadow outer declarations (cpp:S1117) Only local variables and definition parameters are renamed; shadowing struct fields and enumerators in headers are left for a separate change. * refactor(sonar): reduce enum qualification with using enum (cpp:S6177) Applied only where no unqualified name in the block could be captured by the introduced enumerators. * refactor(sonar): mark converting constructors explicit (cpp:S1709) sound_source and the gl::object conversion operators stay implicit; they are relied upon by copy-list-initialisation and GL calls. * refactor(sonar): initialise members in initialiser lists or declarations (cpp:S3230) * refactor(sonar): make read-only local references and pointers const (cpp:S5350) * refactor(sonar): take read-only pointer and reference parameters as const (cpp:S995) TTrain command handlers keep their signature, it is fixed by the handler table. * refactor(sonar): pass expensive-to-copy parameters by const reference (cpp:S1238) Signatures declared in files touched by PR 206 (Driver.h, EU07.cpp) and virtual overrides are left unchanged. * refactor(sonar): use transparent comparators for string-keyed maps (cpp:S6045) std::unordered_map instances and map types exposed in headers used by other modules are left as they are. * fix(sonar): do not use UI text as a printf format string (cpp:S5281) Text lines containing '%' would otherwise be interpreted as format specifiers by ImGui::TextColored. * refactor(sonar): use std::bind_front for callbacks (cpp:S5995) * refactor(sonar): drop const_cast on string literals passed to the Python C API (cpp:S859) * refactor(sonar): take read-only string parameters as std::string_view (cpp:S6009) The Windows messaging helpers keep std::string, they need c_str(). * refactor(sonar): make read-only global tables const (cpp:S5421) Mutable global state (flags, timers, singletons) is left as is. * refactor(sonar): replace single-case switch statements with if (cpp:S1301) * refactor(sonar): format UUIDs and log timestamps with std::format (cpp:S6494, cpp:S5945) * refactor(sonar): use std::array for local fixed-size arrays (cpp:S5945) Arrays that are class members or part of headers are left unchanged. * fix(sonar): test the bearing damage bit, not bit 0 (cpp:S872) 'DamageFlag & dtrain_bearing > 0' parsed as 'DamageFlag & (dtrain_bearing > 0)', i.e. DamageFlag & 1, so bearing friction reacted to the wrong damage flag. * refactor(sonar): assorted small fixes - empty() instead of size() comparisons (cpp:S1155) - member initialisers in declaration order (cpp:S3229) - no redundant c_str() when a std::string is accepted (cpp:S7121) - contains() on associative containers (cpp:S6171) - const reference instead of a copying range-for (cpp:S6032) - starts_with() for prefix checks (cpp:S6178) - no std::move on temporaries (cpp:S5274) - has_value() on std::optional (cpp:S7172) - bool literals for bool members (cpp:S5820) - inline only on the definition (cpp:S3548) - explicit base access specifier (cpp:S5965) - explicit element access instead of dereferencing an array (cpp:S7116) - rely on the C++20 rewritten operator!= (cpp:S6186) * refactor(sonar): more small fixes - std::format instead of iostream manipulators in to_string/to_hex_str (cpp:S6495); output verified identical, negative hex values keep the unsigned form - remove an empty compound statement (cpp:S108) - drop an always-false unsigned < 0 branch (cpp:S1768) - explicit lambda capture (cpp:S3608) - std::make_unique (cpp:S5950) * chore: strip stray carriage returns left in TTrain constructor comments * fix: keep quantize() in its own value type The S5276 change cast the result of the generic quantize<Type_>() to unsigned int, which truncated float/double callers (shadow angle slider, editor rotation snapping, AI speed control steps) and broke negative values. * fix(sonar): use integer loop counters in segment sampling (cpp:S2193) * refactor(sonar): clean up issues reported on PR 209 - remove locals left unused after the dead-store cleanup (cpp:S1481, cpp:S1854) - unnamed unused parameter (cpp:S1172) - single-use declarations moved into if init-statements (cpp:S6004) - auto for casted initialisers (cpp:S5827) - const references and pointers where nothing is modified (cpp:S5350) - rename structured bindings shadowed by inner declarations (cpp:S1117)
This commit is contained in:
@@ -38,7 +38,7 @@ void
|
||||
TController::remove_hint( driver_hint const Value ) {
|
||||
|
||||
m_hints.remove_if(
|
||||
[=]( auto const &Hint ) {
|
||||
[Value]( auto const &Hint ) {
|
||||
return std::get<driver_hint>(Hint) == Value; } );
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::batteryoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->BatteryStart != start_t::manual || mvOccupied->Power24vIsAvailable == true; } );
|
||||
break;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::batteryon );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->BatteryStart != start_t::manual || mvOccupied->Power24vIsAvailable == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -111,7 +111,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::cabdeactivation );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->AutomaticCabActivation || mvOccupied->IsCabMaster(); } );
|
||||
break;
|
||||
}
|
||||
@@ -122,7 +122,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::cabactivation );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->AutomaticCabActivation || (mvOccupied->CabMaster == false && mvOccupied->CabActive == 0); } );
|
||||
break;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::radiooff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->Radio == true; } );
|
||||
break;
|
||||
}
|
||||
@@ -144,7 +144,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const Parameter) {
|
||||
return iRadioChannel == static_cast<int>(Parameter); },
|
||||
Actionparameter );
|
||||
break;
|
||||
@@ -156,7 +156,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::radioon );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->Radio == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::oilpumpoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[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; } );
|
||||
break;
|
||||
@@ -180,7 +180,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::oilpumpon );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const &device { mvOccupied->OilPump };
|
||||
return device.start_type != start_t::manual || (device.is_enabled == false && device.is_active == false); } );
|
||||
break;
|
||||
@@ -193,7 +193,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::fuelpumpoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const &device { mvOccupied->FuelPump };
|
||||
return device.start_type != start_t::manual || device.is_enabled == true || device.is_active == true; } );
|
||||
break;
|
||||
@@ -205,7 +205,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::fuelpumpon );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const &device { mvOccupied->FuelPump };
|
||||
return device.start_type != start_t::manual || (device.is_enabled == false && device.is_active == false); } );
|
||||
break;
|
||||
@@ -218,7 +218,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::pantographairsourcesetauxiliary );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvPantographUnit->bPantKurek3 == true; } );
|
||||
break;
|
||||
}
|
||||
@@ -229,7 +229,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::pantographcompressoron );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvPantographUnit->bPantKurek3 == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -240,7 +240,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::pantographcompressoroff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvPantographUnit->PantCompFlag == true; } );
|
||||
break;
|
||||
}
|
||||
@@ -251,7 +251,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::pantographcompressoron );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvPantographUnit->PantCompFlag == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -262,7 +262,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::pantographsvalveoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvPantographUnit->PantsValve.is_active == true; } );
|
||||
break;
|
||||
}
|
||||
@@ -273,7 +273,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::frontpantographvalveoff );
|
||||
hint(
|
||||
Action,
|
||||
[ this ]( float const Parameter ) -> bool {
|
||||
[ this ]( float const Parameter ) {
|
||||
return mvPantographUnit->Pantographs[end::front].valve.is_active == true || (Parameter > 0 && mvOccupied->Vel > Parameter); },
|
||||
Actionparameter );
|
||||
break;
|
||||
@@ -285,7 +285,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::frontpantographvalveon );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvPantographUnit->Pantographs[end::front].valve.is_active == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -296,7 +296,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::rearpantographvalveoff );
|
||||
hint(
|
||||
Action,
|
||||
[ this ]( float const Parameter ) -> bool {
|
||||
[ this ]( float const Parameter ) {
|
||||
return mvPantographUnit->Pantographs[end::rear].valve.is_active == true || (Parameter > 0 && mvOccupied->Vel > Parameter); },
|
||||
Actionparameter );
|
||||
break;
|
||||
@@ -308,7 +308,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::rearpantographvalveon );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvPantographUnit->Pantographs[end::rear].valve.is_active == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -320,7 +320,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::converteroff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return IsAnyConverterEnabled == true; } );
|
||||
break;
|
||||
}
|
||||
@@ -331,7 +331,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::converteron );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return IsAnyConverterExplicitlyEnabled == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -342,7 +342,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->ConverterOverloadRelayStart != start_t::manual || mvOccupied->ConvOvldFlag == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -352,7 +352,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->GroundRelayStart != start_t::manual || mvOccupied->GroundRelay == true; } );
|
||||
break;
|
||||
}
|
||||
@@ -362,7 +362,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->FuseFlag == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -374,7 +374,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::linebreakeropen );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return IsAnyLineBreakerOpen == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -385,7 +385,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::linebreakerclose );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
// TBD, TODO: replace with consist-wide flag set true if any line breaker is closed?
|
||||
return mvControlling->Mains == false; } );
|
||||
break;
|
||||
@@ -398,7 +398,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::compressoroff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return IsAnyCompressorEnabled == true; } );
|
||||
break;
|
||||
}
|
||||
@@ -409,7 +409,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::compressoron );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return IsAnyCompressorExplicitlyEnabled == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -421,7 +421,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::frontmotorblowersoff );
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const Parameter ) -> bool {
|
||||
[this]( float const /*Parameter*/ ) {
|
||||
auto const &device { mvOccupied->MotorBlowers[ end::front ] };
|
||||
return device.start_type != start_t::manual || (device.is_enabled == true && device.is_disabled == false); } );
|
||||
break;
|
||||
@@ -434,7 +434,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::rearmotorblowersoff );
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const Parameter ) -> bool {
|
||||
[this]( float const /*Parameter*/ ) {
|
||||
auto const &device { mvOccupied->MotorBlowers[ end::rear ] };
|
||||
return device.start_type != start_t::manual || (device.is_enabled == true && device.is_disabled == false); } );
|
||||
break;
|
||||
@@ -447,7 +447,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::springbrakeoff );
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const Parameter ) -> bool {
|
||||
[this]( float const /*Parameter*/ ) {
|
||||
return mvOccupied->SpringBrake.Activate == true; } );
|
||||
break;
|
||||
}
|
||||
@@ -458,7 +458,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::springbrakeon );
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const Parameter ) -> bool {
|
||||
[this]( float const /*Parameter*/ ) {
|
||||
return mvOccupied->SpringBrake.Activate == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -470,7 +470,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::manualbrakoff );
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const Parameter ) -> bool {
|
||||
[this]( float const /*Parameter*/ ) {
|
||||
return mvOccupied->LocalBrake != TLocalBrake::ManualBrake || mvOccupied->MBrake == false || mvOccupied->ManualBrakePos == ManualBrakePosNo; } );
|
||||
break;
|
||||
}
|
||||
@@ -481,7 +481,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::manualbrakon );
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const Parameter ) -> bool {
|
||||
[this]( float const /*Parameter*/ ) {
|
||||
return mvOccupied->LocalBrake != TLocalBrake::ManualBrake || mvOccupied->MBrake == false || mvOccupied->ManualBrakePos == 0; } );
|
||||
break;
|
||||
}
|
||||
@@ -490,33 +490,31 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
if( AIControllFlag ) {
|
||||
while( mvControlling->RList[mvControlling->MainCtrlPos].Mn == 0
|
||||
&& mvControlling->IncMainCtrl(1) ) {
|
||||
;
|
||||
// all work is done in the loop header
|
||||
}
|
||||
}
|
||||
remove_master_controller_hints();
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const Parameter ) -> bool {
|
||||
[this]( float const /*Parameter*/ ) {
|
||||
return mvControlling->RList[mvControlling->MainCtrlPos].Mn > 0; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::mastercontrollersetseriesmode: {
|
||||
if( AIControllFlag ) {
|
||||
if( mvControlling->RList[ mvControlling->MainCtrlPos ].Bn > 1 ) {
|
||||
// limit yourself to series mode
|
||||
if( mvControlling->ScndCtrlPos ) {
|
||||
mvControlling->DecScndCtrl( 2 );
|
||||
}
|
||||
while( mvControlling->RList[mvControlling->MainCtrlPos].Bn > 1
|
||||
&& mvControlling->DecMainCtrl(1) ) {
|
||||
; // all work is performed in the header
|
||||
}
|
||||
if (AIControllFlag && mvControlling->RList[ mvControlling->MainCtrlPos ].Bn > 1) {
|
||||
// limit yourself to series mode
|
||||
if( mvControlling->ScndCtrlPos ) {
|
||||
mvControlling->DecScndCtrl( 2 );
|
||||
}
|
||||
while( mvControlling->RList[mvControlling->MainCtrlPos].Bn > 1
|
||||
&& mvControlling->DecMainCtrl(1) ) {
|
||||
// all work is performed in the header
|
||||
}
|
||||
}
|
||||
remove_master_controller_hints();
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const Parameter ) -> bool {
|
||||
[this]( float const /*Parameter*/ ) {
|
||||
return mvControlling->RList[mvControlling->MainCtrlPos].Bn < 2; } );
|
||||
break;
|
||||
}
|
||||
@@ -527,7 +525,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_master_controller_hints();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvControlling->IsMainCtrlNoPowerPos() && mvControlling->IsScndCtrlNoPowerPos(); } );
|
||||
break;
|
||||
}
|
||||
@@ -535,15 +533,15 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
if( AIControllFlag ) {
|
||||
while( false == mvControlling->EIMDirectionChangeAllow()
|
||||
&& mvControlling->DecMainCtrl(1) ) {
|
||||
;
|
||||
// all work is done in the loop header
|
||||
}
|
||||
}
|
||||
remove_master_controller_hints();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvControlling->EIMDirectionChangeAllow(); },
|
||||
mvControlling->MainCtrlMaxDirChangePos );
|
||||
static_cast<float>(mvControlling->MainCtrlMaxDirChangePos) );
|
||||
break;
|
||||
}
|
||||
case driver_hint::tractiveforcedecrease: {
|
||||
@@ -553,13 +551,13 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_master_controller_hints();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const Parameter) {
|
||||
return std::abs(mvControlling->Ft) <= Parameter; },
|
||||
std::min(
|
||||
static_cast<float>(std::min(
|
||||
0.0,
|
||||
std::max(
|
||||
std::abs( mvControlling->Ft ) * 0.95,
|
||||
std::abs( mvControlling->Ft ) - 5.0 ) ) );
|
||||
std::abs( mvControlling->Ft ) - 5.0 ) )) );
|
||||
break;
|
||||
}
|
||||
case driver_hint::tractiveforceincrease: {
|
||||
@@ -575,21 +573,19 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[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()); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::bufferscompress: {
|
||||
if( AIControllFlag ) {
|
||||
if( std::abs( mvControlling->Ft ) < 50000.0 ) {
|
||||
IncSpeed();
|
||||
}
|
||||
if (AIControllFlag && std::abs( mvControlling->Ft ) < 50000.0) {
|
||||
IncSpeed();
|
||||
}
|
||||
remove_master_controller_hints();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return std::abs(mvControlling->Ft) > 30.0 || (OrderCurrentGet() & Disconnect) == 0; } );
|
||||
break;
|
||||
}
|
||||
@@ -601,7 +597,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_master_controller_hints();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvControlling->IsScndCtrlNoPowerPos(); } );
|
||||
break;
|
||||
}
|
||||
@@ -613,7 +609,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::waterpumpoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const &device { mvControlling->WaterPump };
|
||||
return device.start_type != start_t::manual || (device.is_enabled == true && device.is_disabled == false) || device.is_active == true; } );
|
||||
break;
|
||||
@@ -625,7 +621,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::waterpumpon );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const &device { mvControlling->WaterPump };
|
||||
return device.start_type != start_t::manual || (device.is_enabled == false && device.is_active == false); } );
|
||||
break;
|
||||
@@ -637,7 +633,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::waterpumpbreakeroff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const &device { mvControlling->WaterPump };
|
||||
return device.breaker == true; } );
|
||||
break;
|
||||
@@ -649,7 +645,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::waterpumpbreakeron );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const &device { mvControlling->WaterPump };
|
||||
return device.breaker == false; } );
|
||||
break;
|
||||
@@ -661,7 +657,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::waterheateroff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const &device { mvControlling->WaterHeater };
|
||||
return device.is_enabled == true; } );
|
||||
break;
|
||||
@@ -673,7 +669,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::waterheateron );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const &device { mvControlling->WaterHeater };
|
||||
return device.is_enabled == false; } );
|
||||
break;
|
||||
@@ -685,7 +681,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::waterheaterbreakeroff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const &device { mvControlling->WaterHeater };
|
||||
return device.breaker == true; } );
|
||||
break;
|
||||
@@ -697,7 +693,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::waterheaterbreakeron );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const &device { mvControlling->WaterHeater };
|
||||
return device.breaker == false; } );
|
||||
break;
|
||||
@@ -709,7 +705,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::watercircuitslinkoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvControlling->dizel_heat.auxiliary_water_circuit == false || mvControlling->WaterCircuitsLink == true; } );
|
||||
break;
|
||||
}
|
||||
@@ -720,7 +716,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::watercircuitslinkon );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvControlling->dizel_heat.auxiliary_water_circuit == false || mvControlling->WaterCircuitsLink == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -728,7 +724,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
// NOTE: this action doesn't have AI component
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return false == IsHeatingTemperatureTooLow; } );
|
||||
break;
|
||||
}
|
||||
@@ -736,7 +732,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
// NOTE: this action doesn't have AI component
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvControlling->ScndPipePress > 4.5 || mvControlling->VeselVolume == 0.0; } );
|
||||
break;
|
||||
}
|
||||
@@ -744,7 +740,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
// NOTE: this action doesn't have AI component
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvPantographUnit->PantPress >= (is_emu() ? (mvPantographUnit->PantPressLockActive ? 4.6 : 2.6) : 4.2); } );
|
||||
break;
|
||||
}
|
||||
@@ -752,7 +748,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
// NOTE: this action doesn't have AI component
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return ExchangeTime <= 0; } );
|
||||
break;
|
||||
}
|
||||
@@ -760,7 +756,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
// NOTE: this action doesn't have AI component
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return IsAtPassengerStop == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -773,19 +769,16 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
// driver_hint_brakingforcesetzero
|
||||
// driver_hint_brakingforcelap
|
||||
case driver_hint::trainbrakesetpipeunlock: {
|
||||
if( AIControllFlag ) {
|
||||
if( mvOccupied->HandleUnlock != -3 ) {
|
||||
while( BrakeCtrlPosition >= mvOccupied->HandleUnlock
|
||||
&& BrakeLevelAdd(-1) ) {
|
||||
// all work is done in the header
|
||||
;
|
||||
}
|
||||
if (AIControllFlag && mvOccupied->HandleUnlock != -3) {
|
||||
while( BrakeCtrlPosition >= mvOccupied->HandleUnlock
|
||||
&& BrakeLevelAdd(-1) ) {
|
||||
// all work is done in the header
|
||||
}
|
||||
}
|
||||
remove_train_brake_hints();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->HandleUnlock == -3 || BrakeCtrlPosition == mvOccupied->HandleUnlock; } );
|
||||
break;
|
||||
}
|
||||
@@ -797,7 +790,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_train_brake_hints();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[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 ( BrakeCtrlPosition == gbh_RP ); } );
|
||||
break;
|
||||
@@ -815,7 +808,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_train_brake_hints();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return IsConsistBraked /*|| ( ( OrderCurrentGet() & Disconnect ) == 0 ) */; } );
|
||||
break;
|
||||
}
|
||||
@@ -830,9 +823,9 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_train_brake_hints();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const Parameter) {
|
||||
return std::abs(mvControlling->Fb) <= Parameter; },
|
||||
std::min( 0.0, 0.95 * std::abs( mvControlling->Fb ) ) ); // keep hint until 5% decrease
|
||||
static_cast<float>(std::min( 0.0, 0.95 * std::abs( mvControlling->Fb ) )) ); // keep hint until 5% decrease
|
||||
break;
|
||||
}
|
||||
case driver_hint::brakingforceincrease: {
|
||||
@@ -846,23 +839,25 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_train_brake_hints();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const Parameter) {
|
||||
return std::abs(mvControlling->Fb) > Parameter || is_equal(mvOccupied->fBrakeCtrlPos, mvOccupied->Handle->GetPos(bh_EB), 0.2); },
|
||||
std::max(
|
||||
static_cast<float>(std::max(
|
||||
0.0,
|
||||
std::max(
|
||||
std::abs( mvControlling->Fb ) * 1.05,
|
||||
std::abs( mvControlling->Fb ) + 5.0 ) ) );
|
||||
std::abs( mvControlling->Fb ) + 5.0 ) )) );
|
||||
break;
|
||||
}
|
||||
case driver_hint::brakingforcesetzero: { // releases both train and independent brake
|
||||
if( AIControllFlag ) {
|
||||
while( true == DecBrake() ) { ; }
|
||||
while( true == DecBrake() ) {
|
||||
// all work is done in the loop condition
|
||||
}
|
||||
}
|
||||
remove_train_brake_hints();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return Ready && fReady < 0.4 && is_equal(mvOccupied->fBrakeCtrlPos, mvOccupied->Handle->GetPos(bh_RP), 0.2); } );
|
||||
break;
|
||||
}
|
||||
@@ -877,18 +872,16 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
// independent brake
|
||||
case driver_hint::independentbrakeapply: {
|
||||
if( AIControllFlag ) {
|
||||
if( mvOccupied->LocalBrakePosA < 1.0 ) {
|
||||
mvOccupied->IncLocalBrakeLevel( LocalBrakePosNo );
|
||||
if (mvOccupied->EIMCtrlEmergency) {
|
||||
mvOccupied->DecLocalBrakeLevel(1);
|
||||
if (AIControllFlag && mvOccupied->LocalBrakePosA < 1.0) {
|
||||
mvOccupied->IncLocalBrakeLevel( LocalBrakePosNo );
|
||||
if (mvOccupied->EIMCtrlEmergency) {
|
||||
mvOccupied->DecLocalBrakeLevel(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
remove_hint( driver_hint::independentbrakerelease );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const Parameter) {
|
||||
return mvOccupied->LocalBrakePosA >= Parameter; },
|
||||
( LocalBrakePosNo - ( mvOccupied->EIMCtrlEmergency ? 1 : 0 ) ) / LocalBrakePosNo );
|
||||
break;
|
||||
@@ -900,7 +893,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::independentbrakeapply );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->LocalBrakePosA < 0.05; } );
|
||||
break;
|
||||
}
|
||||
@@ -912,7 +905,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_reverser_hints();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->DirActive * mvOccupied->CabActive > 0; } );
|
||||
break;
|
||||
}
|
||||
@@ -923,7 +916,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_reverser_hints();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->DirActive * mvOccupied->CabActive < 0; } );
|
||||
break;
|
||||
}
|
||||
@@ -936,7 +929,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_reverser_hints();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return iDirection == iDirectionOrder; } );
|
||||
break;
|
||||
}
|
||||
@@ -947,7 +940,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_reverser_hints();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->DirActive == 0; } );
|
||||
break;
|
||||
}
|
||||
@@ -959,7 +952,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::sandingoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvControlling->Sand == 0 || mvControlling->SandDose == true || mvControlling->SlippingWheels == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -970,7 +963,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::sandingon );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvControlling->Sand == 0 || mvControlling->SandDose == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -980,7 +973,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvControlling->ASBType != 1 || (mvControlling->Hamulec->GetBrakeStatus() & b_asb) != 0 || mvControlling->SlippingWheels == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -992,7 +985,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::hornoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
// NOTE: we provide slightly larger horn activation window for human driver
|
||||
return fWarningDuration + 5.0 < 0.05 || mvOccupied->WarningSignal != 0; } );
|
||||
break;
|
||||
@@ -1019,7 +1012,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
// TODO: remove other door lock hints
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->Doors.has_lock == false || mvOccupied->Doors.lock_enabled == true; } );
|
||||
break;
|
||||
}
|
||||
@@ -1031,7 +1024,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::departuresignaloff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->Doors.has_warning == false || mvOccupied->Doors.has_autowarning == true || mvOccupied->DepartureSignal == true || mvOccupied->Vel > 5.0; } );
|
||||
break;
|
||||
}
|
||||
@@ -1042,7 +1035,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::departuresignalon );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->Doors.has_warning == false || mvOccupied->Doors.has_autowarning == true || mvOccupied->DepartureSignal == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -1055,7 +1048,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::doorrightclose );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return IsAnyDoorOpen[side::right] == true; } );
|
||||
break;
|
||||
}
|
||||
@@ -1067,7 +1060,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::doorrightopen );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return IsAnyDoorOpen[side::right] == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -1079,7 +1072,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::doorleftclose );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return IsAnyDoorOpen[side::left] == true; } );
|
||||
break;
|
||||
}
|
||||
@@ -1091,7 +1084,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::doorleftopen );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return IsAnyDoorOpen[side::left] == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -1102,7 +1095,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::doorrightpermitoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return IsAnyDoorPermitActive[side::right] == true; } );
|
||||
break;
|
||||
}
|
||||
@@ -1113,7 +1106,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::doorrightpermiton );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return IsAnyDoorPermitActive[side::right] == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -1124,7 +1117,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::doorleftpermitoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return IsAnyDoorPermitActive[side::left] == true; } );
|
||||
break;
|
||||
}
|
||||
@@ -1135,7 +1128,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::doorleftpermiton );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return IsAnyDoorPermitActive[side::left] == false; } );
|
||||
break;
|
||||
}
|
||||
@@ -1148,7 +1141,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::consistlightsoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const &device { mvOccupied->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;
|
||||
@@ -1161,7 +1154,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::consistlightson );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const &device { mvOccupied->CompartmentLights };
|
||||
return Global.fLuminance * ConsistShade < 0.35 || device.start_type != start_t::manual || (device.is_enabled == false && device.is_active == false); } );
|
||||
break;
|
||||
@@ -1174,7 +1167,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::consistheatingoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->HeatingAllow == true; } );
|
||||
break;
|
||||
}
|
||||
@@ -1185,52 +1178,48 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::consistheatingon );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvOccupied->HeatingAllow == false; } );
|
||||
break;
|
||||
}
|
||||
|
||||
case driver_hint::securitysystemreset: {
|
||||
if( AIControllFlag ) {
|
||||
if (mvOccupied->SecuritySystem.is_blinking())
|
||||
mvOccupied->SecuritySystemReset();
|
||||
}
|
||||
if (AIControllFlag && mvOccupied->SecuritySystem.is_blinking())
|
||||
mvOccupied->SecuritySystemReset();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return !mvOccupied->SecuritySystem.is_vigilance_blinking(); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::shpsystemreset: {
|
||||
if( AIControllFlag ) {
|
||||
if (mvOccupied->SecuritySystem.is_cabsignal_blinking())
|
||||
mvOccupied->SecuritySystem.cabsignal_reset();
|
||||
}
|
||||
if (AIControllFlag && mvOccupied->SecuritySystem.is_cabsignal_blinking())
|
||||
mvOccupied->SecuritySystem.cabsignal_reset();
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return !mvOccupied->SecuritySystem.is_cabsignal_blinking(); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::couplingadapterattach: {
|
||||
// TODO: run also for potential settings-based virtual assistant
|
||||
if( AIControllFlag ) {
|
||||
pVehicles[ end::front ]->attach_coupler_adapter( Actionparameter );
|
||||
pVehicles[ end::front ]->attach_coupler_adapter( static_cast<int>(Actionparameter) );
|
||||
}
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const Parameter) {
|
||||
auto const &device { pVehicles[ end::front ]->MoverParameters->Couplers[ static_cast<int>( Parameter ) ] };
|
||||
return device.type() == TCouplerType::Automatic; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::couplingadapterremove: {
|
||||
if( AIControllFlag || Global.AITrainman ) {
|
||||
pVehicles[ end::front ]->remove_coupler_adapter( Actionparameter );
|
||||
pVehicles[ end::front ]->remove_coupler_adapter( static_cast<int>(Actionparameter) );
|
||||
}
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const Parameter) {
|
||||
auto const &device { pVehicles[ end::front ]->MoverParameters->Couplers[ static_cast<int>( Parameter ) ] };
|
||||
return false == device.has_adapter(); } );
|
||||
break;
|
||||
@@ -1245,7 +1234,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::lightsoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return pVehicles[end::front]->has_signal_pc1_on(); } );
|
||||
break;
|
||||
}
|
||||
@@ -1258,7 +1247,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::lightsoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return pVehicles[end::front]->has_signal_pc2_on(); } );
|
||||
break;
|
||||
}
|
||||
@@ -1275,7 +1264,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::lightsoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const activeend { mvOccupied->CabActive >= 0 ? end::front : end::rear };
|
||||
auto const consistfront { mvOccupied->DirActive >= 0 ? end::front : end::rear };
|
||||
return pVehicles[consistfront]->has_signal_on(activeend, light::headlight_right) && pVehicles[1 - consistfront]->has_signal_on(1 - activeend, light::headlight_left); } );
|
||||
@@ -1290,7 +1279,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::lightsoff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return pVehicles[end::rear]->has_signal_pc5_on(); } );
|
||||
break;
|
||||
}
|
||||
@@ -1304,7 +1293,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::headcodetb1 );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const activeend { mvOccupied->CabActive >= 0 ? end::front : end::rear };
|
||||
auto const consistfront { mvOccupied->DirActive >= 0 ? end::front : end::rear };
|
||||
return pVehicles[consistfront]->has_signal_on(activeend, 0) && pVehicles[1 - consistfront]->has_signal_on(1 - activeend, 0); } );
|
||||
@@ -1318,7 +1307,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::releaseroff );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return true == mvOccupied->Hamulec->Releaser(); } );
|
||||
break;
|
||||
}
|
||||
@@ -1329,7 +1318,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
remove_hint( driver_hint::releaseron );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const /*Parameter*/) {
|
||||
return false == mvOccupied->Hamulec->Releaser(); } );
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user