mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-21 22:34:58 +01:00
refactor: change typedef, nullptr, scoped_lock and others
This commit is contained in:
@@ -18,8 +18,8 @@ http://mozilla.org/MPL/2.0/.
|
||||
// IEEE-1284 Controller
|
||||
|
||||
HINSTANCE hDLL;
|
||||
typedef USHORT(__stdcall *InPortType)(USHORT BasePort);
|
||||
typedef void(__stdcall *OutPortType)(USHORT BasePort, USHORT value);
|
||||
using InPortType = USHORT(__stdcall *)(USHORT BasePort);
|
||||
using OutPortType = void(__stdcall *)(USHORT BasePort, USHORT value);
|
||||
InPortType InPort;
|
||||
OutPortType OutPort;
|
||||
|
||||
|
||||
@@ -764,7 +764,7 @@ enum class TLocalBrake
|
||||
HydraulicBrake
|
||||
};
|
||||
/// <summary>Brake delay parameter table (apply/release for passenger and freight).</summary>
|
||||
typedef double TBrakeDelayTable[4];
|
||||
using TBrakeDelayTable = double[4];
|
||||
|
||||
/// <summary>One row of the brake pressure / pipe pressure / flow-speed table for a brake handle position.</summary>
|
||||
struct TBrakePressure
|
||||
@@ -780,7 +780,7 @@ struct TBrakePressure
|
||||
};
|
||||
|
||||
/// <summary>Brake pressure table indexed by handle position.</summary>
|
||||
typedef std::map<int, TBrakePressure> TBrakePressureTable;
|
||||
using TBrakePressureTable = std::map<int, TBrakePressure>;
|
||||
|
||||
/// <summary>Engine / drive type.</summary>
|
||||
enum class TEngineType
|
||||
@@ -1048,7 +1048,7 @@ struct TScheme
|
||||
bool AutoSwitch = false; /*czy dana pozycja nastawniana jest recznie czy autom.*/
|
||||
int ScndAct = 0; /*jesli ma bocznik w nastawniku, to ktory bocznik na ktorej pozycji*/
|
||||
};
|
||||
typedef TScheme TSchemeTable[ResArraySize + 1]; /*tablica rezystorow rozr.*/
|
||||
using TSchemeTable = TScheme[ResArraySize + 1]; /*tablica rezystorow rozr.*/
|
||||
struct TDEScheme
|
||||
{
|
||||
double RPM = 0.0; /*obroty diesla*/
|
||||
@@ -1056,13 +1056,13 @@ struct TDEScheme
|
||||
double Umax = 0.0; /*napiecie maksymalne*/
|
||||
double Imax = 0.0; /*prad maksymalny*/
|
||||
};
|
||||
typedef TDEScheme TDESchemeTable[33]; /*tablica WWList dla silnikow spalinowych*/
|
||||
using TDESchemeTable = TDEScheme[33]; /*tablica WWList dla silnikow spalinowych*/
|
||||
struct TFFScheme
|
||||
{
|
||||
double v = 0.0; // parametr wejsciowy
|
||||
double freq = 0.0; // wyjscie: czestotliwosc falownika
|
||||
};
|
||||
typedef TFFScheme TFFSchemeTable[33];
|
||||
using TFFSchemeTable = TFFScheme[33];
|
||||
|
||||
struct TWiperScheme
|
||||
{
|
||||
@@ -1071,7 +1071,7 @@ struct TWiperScheme
|
||||
double interval = 0.0; // interwal pracy wycieraczki
|
||||
double outBackDelay = 0.0; // czas po jakim wycieraczka zacznie wracac z konca do poczatku
|
||||
};
|
||||
typedef TWiperScheme TWiperSchemeTable[16];
|
||||
using TWiperSchemeTable = TWiperScheme[16];
|
||||
|
||||
struct TShuntScheme
|
||||
{
|
||||
@@ -1080,13 +1080,13 @@ struct TShuntScheme
|
||||
double Pmin = 0.0;
|
||||
double Pmax = 0.0;
|
||||
};
|
||||
typedef TShuntScheme TShuntSchemeTable[33];
|
||||
using TShuntSchemeTable = TShuntScheme[33];
|
||||
struct TMPTRelay
|
||||
{ /*lista przekaznikow bocznikowania*/
|
||||
double Iup = 0.0;
|
||||
double Idown = 0.0;
|
||||
};
|
||||
typedef TMPTRelay TMPTRelayTable[8];
|
||||
using TMPTRelayTable = TMPTRelay[8];
|
||||
|
||||
struct TMotorParameters
|
||||
{
|
||||
|
||||
@@ -275,7 +275,7 @@ class TReservoir
|
||||
};
|
||||
|
||||
/// <summary>Pointer typedef for a reservoir instance.</summary>
|
||||
typedef TReservoir *PReservoir;
|
||||
using PReservoir = TReservoir *;
|
||||
|
||||
/// <summary>
|
||||
/// Brake cylinder reservoir — overrides pressure functions to model the
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -496,7 +496,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->RList[mvControlling->MainCtrlPos].Mn > 0; } );
|
||||
break;
|
||||
}
|
||||
@@ -516,7 +516,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->RList[mvControlling->MainCtrlPos].Bn < 2; } );
|
||||
break;
|
||||
}
|
||||
@@ -527,7 +527,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;
|
||||
}
|
||||
@@ -541,7 +541,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->EIMDirectionChangeAllow(); },
|
||||
mvControlling->MainCtrlMaxDirChangePos );
|
||||
break;
|
||||
@@ -553,7 +553,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 std::abs(mvControlling->Ft) <= Parameter; },
|
||||
std::min(
|
||||
0.0,
|
||||
@@ -575,7 +575,7 @@ 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;
|
||||
@@ -589,7 +589,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 std::abs(mvControlling->Ft) > 30.0 || (OrderCurrentGet() & Disconnect) == 0; } );
|
||||
break;
|
||||
}
|
||||
@@ -601,7 +601,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 +613,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 +625,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 +637,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 +649,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 +661,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 +673,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 +685,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 +697,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 +709,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 +720,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 +728,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 +736,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 +744,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 +752,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 +760,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;
|
||||
}
|
||||
@@ -785,7 +785,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 mvOccupied->HandleUnlock == -3 || BrakeCtrlPosition == mvOccupied->HandleUnlock; } );
|
||||
break;
|
||||
}
|
||||
@@ -797,7 +797,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 +815,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,7 +830,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 std::abs(mvControlling->Fb) <= Parameter; },
|
||||
std::min( 0.0, 0.95 * std::abs( mvControlling->Fb ) ) ); // keep hint until 5% decrease
|
||||
break;
|
||||
@@ -846,7 +846,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 std::abs(mvControlling->Fb) > Parameter || is_equal(mvOccupied->fBrakeCtrlPos, mvOccupied->Handle->GetPos(bh_EB), 0.2); },
|
||||
std::max(
|
||||
0.0,
|
||||
@@ -862,7 +862,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 Ready && fReady < 0.4 && is_equal(mvOccupied->fBrakeCtrlPos, mvOccupied->Handle->GetPos(bh_RP), 0.2); } );
|
||||
break;
|
||||
}
|
||||
@@ -888,7 +888,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
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 +900,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 +912,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 +923,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 +936,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 +947,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 +959,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 +970,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 +980,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 +992,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 +1019,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 +1031,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 +1042,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 +1055,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 +1067,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 +1079,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 +1091,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 +1102,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 +1113,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 +1124,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 +1135,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 +1148,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 +1161,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 +1174,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,7 +1185,7 @@ 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;
|
||||
}
|
||||
@@ -1197,7 +1197,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const Parameter) {
|
||||
return !mvOccupied->SecuritySystem.is_vigilance_blinking(); } );
|
||||
break;
|
||||
}
|
||||
@@ -1208,7 +1208,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
}
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
[this](float const Parameter) {
|
||||
return !mvOccupied->SecuritySystem.is_cabsignal_blinking(); } );
|
||||
break;
|
||||
}
|
||||
@@ -1219,7 +1219,7 @@ TController::cue_action( driver_hint const Action, float const 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;
|
||||
@@ -1230,7 +1230,7 @@ TController::cue_action( driver_hint const Action, float const 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 +1245,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 +1258,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 +1275,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 +1290,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 +1304,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 +1318,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 +1329,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;
|
||||
}
|
||||
|
||||
@@ -1131,7 +1131,7 @@ void editor_mode::capture_terrain()
|
||||
float const cellsize = static_cast<float>(std::max(0.1, extent / cells));
|
||||
|
||||
// sampler: highest captured triangle at (x,z)
|
||||
auto const sampler = [&tris](double X, double Z, double &OutY) -> bool {
|
||||
auto const sampler = [&tris](double X, double Z, double &OutY) {
|
||||
double best = -std::numeric_limits<double>::max();
|
||||
bool found = false;
|
||||
for (auto const &t : tris)
|
||||
|
||||
@@ -103,7 +103,7 @@ std::vector<std::string> scenarioloader_ui::get_random_trivia()
|
||||
}
|
||||
|
||||
// Find byte position corresponding to character count
|
||||
auto get_byte_pos_for_char_count = [&](const std::string& str, size_t char_count) -> size_t {
|
||||
auto get_byte_pos_for_char_count = [&](const std::string& str, size_t char_count) {
|
||||
size_t byte_pos = 0;
|
||||
size_t current_chars = 0;
|
||||
for (size_t i = 0; i < str.length() && current_chars < char_count; )
|
||||
|
||||
@@ -400,7 +400,7 @@ sound_source::play_basic() {
|
||||
// dispatch appropriate sound
|
||||
if( true == m_playbeginning
|
||||
&& sound(sound_id::begin).buffer != null_handle) {
|
||||
std::vector<sound_id> sounds { sound_id::begin, sound_id::main };
|
||||
std::vector sounds { sound_id::begin, sound_id::main };
|
||||
insert( std::begin( sounds ), std::end( sounds ) );
|
||||
m_playbeginning = false;
|
||||
}
|
||||
@@ -1016,7 +1016,7 @@ sound_source::update_soundproofing() {
|
||||
void
|
||||
sound_source::insert( sound_handle const Sound ) {
|
||||
|
||||
std::vector<sound_handle> sounds { Sound };
|
||||
std::vector sounds { Sound };
|
||||
return insert( std::begin( sounds ), std::end( sounds ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ void terrain_streamer::update(glm::dvec3 const &CameraPos)
|
||||
int const cells = m_cells;
|
||||
float const cs = m_cellsize;
|
||||
editor_terrain::height_sampler sampler =
|
||||
[&loaded, x0, z0, cells, cs](double X, double Z, double &OutY) -> bool {
|
||||
[&loaded, x0, z0, cells, cs](double X, double Z, double &OutY) {
|
||||
int ix = static_cast<int>(std::lround((X - x0) / cs));
|
||||
int iz = static_cast<int>(std::lround((Z - z0) / cs));
|
||||
ix = std::clamp(ix, 0, cells);
|
||||
|
||||
@@ -91,14 +91,14 @@ void gl::framebuffer::blit(framebuffer *src, framebuffer *dst, int sx, int sy, i
|
||||
|
||||
{
|
||||
GLenum outputs[8] = { GL_NONE };
|
||||
outputs[attachment_n] = src != 0 ? attachment : GL_BACK_LEFT;
|
||||
outputs[attachment_n] = src != nullptr ? attachment : GL_BACK_LEFT;
|
||||
|
||||
glReadBuffer(attachment);
|
||||
}
|
||||
|
||||
{
|
||||
GLenum outputs[8] = { GL_NONE };
|
||||
outputs[attachment_n] = dst != 0 ? attachment : GL_BACK_LEFT;
|
||||
outputs[attachment_n] = dst != nullptr ? attachment : GL_BACK_LEFT;
|
||||
|
||||
glDrawBuffers(attachment_n + 1, outputs);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ void gl::pbo::request_read(int x, int y, int lx, int ly, int pixsize, GLenum for
|
||||
sync.reset();
|
||||
|
||||
bind(PIXEL_PACK_BUFFER);
|
||||
glReadPixels(x, y, lx, ly, format, type, 0);
|
||||
glReadPixels(x, y, lx, ly, format, type, nullptr);
|
||||
unbind(PIXEL_PACK_BUFFER);
|
||||
|
||||
sync.emplace();
|
||||
|
||||
@@ -313,7 +313,7 @@ gl::shader::shader(const std::string &filename)
|
||||
const GLchar *cstr = source.second.c_str();
|
||||
|
||||
**this = glCreateShader(source.first);
|
||||
glShaderSource(*this, 1, &cstr, 0);
|
||||
glShaderSource(*this, 1, &cstr, nullptr);
|
||||
glCompileShader(*this);
|
||||
|
||||
GLint status;
|
||||
@@ -321,7 +321,7 @@ gl::shader::shader(const std::string &filename)
|
||||
if (!status)
|
||||
{
|
||||
GLchar info[512];
|
||||
glGetShaderInfoLog(*this, 512, 0, info);
|
||||
glGetShaderInfoLog(*this, 512, nullptr, info);
|
||||
log_error(std::string(info));
|
||||
|
||||
throw shader_exception("failed to compile " + filename + ": " + std::string(info));
|
||||
@@ -395,7 +395,7 @@ void gl::program::link()
|
||||
if (!status)
|
||||
{
|
||||
GLchar info[512];
|
||||
glGetProgramInfoLog(*this, 512, 0, info);
|
||||
glGetProgramInfoLog(*this, 512, nullptr, info);
|
||||
throw shader_exception("failed to link program: " + std::string(info));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
typedef int texture_handle;
|
||||
using texture_handle = int;
|
||||
|
||||
#define null_handle (0)
|
||||
|
||||
|
||||
@@ -455,8 +455,8 @@ class command_queue {
|
||||
|
||||
public:
|
||||
// types
|
||||
typedef std::deque<command_data> commanddata_sequence;
|
||||
typedef std::unordered_map<uint32_t, commanddata_sequence> commands_map;
|
||||
using commanddata_sequence = std::deque<command_data>;
|
||||
using commands_map = std::unordered_map<uint32_t, commanddata_sequence>;
|
||||
// methods
|
||||
// posts specified command for specified recipient into m_intercept_queue
|
||||
void
|
||||
@@ -511,7 +511,7 @@ void add_to_dequemap(std::unordered_map<A, std::deque<B>> &lhs, const std::unord
|
||||
// but realistically it's not like we're going to run more than one simulation at a time
|
||||
namespace simulation {
|
||||
|
||||
typedef std::vector<command_description> commanddescription_sequence;
|
||||
using commanddescription_sequence = std::vector<command_description>;
|
||||
|
||||
extern command_queue Commands;
|
||||
// TODO: add name to command map, and wrap these two into helper object
|
||||
|
||||
@@ -84,7 +84,7 @@ private:
|
||||
user_command down;
|
||||
};
|
||||
|
||||
typedef std::unordered_map<std::string, button_bindings> buttonbindings_map;
|
||||
using buttonbindings_map = std::unordered_map<std::string, button_bindings>;
|
||||
|
||||
// methods
|
||||
void
|
||||
|
||||
@@ -66,7 +66,7 @@ OnCommandGet(multiplayer::DaneRozkaz *pRozkaz)
|
||||
if( event != nullptr ) {
|
||||
if( typeid(*event) == typeid(multi_event)
|
||||
|| typeid(*event) == typeid(lights_event)
|
||||
|| event->m_sibling != 0 ) {
|
||||
|| event->m_sibling != nullptr ) {
|
||||
// tylko jawne albo niejawne Multiple
|
||||
command_relay relay;
|
||||
relay.post(user_command::queueevent, 0.0, 0.0, GLFW_PRESS, 0, glm::vec3(0.0f), &event->name());
|
||||
|
||||
@@ -352,7 +352,7 @@ bool TAnimModel::Load(cParser *parser, bool ter)
|
||||
|
||||
if( i < iNumLights
|
||||
&& token != "-1" ) { // -1 leaves the default color intact
|
||||
auto const lightcolor { std::stoi( token, 0, 16 ) };
|
||||
auto const lightcolor { std::stoi( token, nullptr, 16 ) };
|
||||
m_lightcolors[i] = {
|
||||
( lightcolor >> 16 & 0xff ) / 255.f,
|
||||
( lightcolor >> 8 & 0xff ) / 255.f,
|
||||
@@ -655,7 +655,7 @@ int TAnimModel::TerrainCount()
|
||||
|
||||
TSubModel * TAnimModel::TerrainSquare(int n)
|
||||
{ // pobieranie wskaźników do pierwszego submodelu
|
||||
return pModel ? pModel->TerrainSquare(n) : 0;
|
||||
return pModel ? pModel->TerrainSquare(n) : nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -26,8 +26,8 @@ public:
|
||||
|
||||
private:
|
||||
// types:
|
||||
typedef std::deque<TMdlContainer> modelcontainer_sequence;
|
||||
typedef std::unordered_map<std::string, modelcontainer_sequence::size_type> stringmodelcontainerindex_map;
|
||||
using modelcontainer_sequence = std::deque<TMdlContainer>;
|
||||
using stringmodelcontainerindex_map = std::unordered_map<std::string, modelcontainer_sequence::size_type>;
|
||||
// members:
|
||||
static modelcontainer_sequence m_models;
|
||||
static stringmodelcontainerindex_map m_modelsmap;
|
||||
|
||||
@@ -165,13 +165,13 @@ public:
|
||||
|
||||
private:
|
||||
// types:
|
||||
typedef std::pair<
|
||||
using texturetimepoint_pair = std::pair<
|
||||
opengl_texture *,
|
||||
resource_timestamp > texturetimepoint_pair;
|
||||
resource_timestamp >;
|
||||
|
||||
typedef std::vector< texturetimepoint_pair > texturetimepointpair_sequence;
|
||||
using texturetimepointpair_sequence = std::vector< texturetimepoint_pair >;
|
||||
|
||||
typedef std::unordered_map<std::string, std::size_t> index_map;
|
||||
using index_map = std::unordered_map<std::string, std::size_t>;
|
||||
|
||||
// methods:
|
||||
// checks whether specified texture is in the texture bank. returns texture id, or npos.
|
||||
|
||||
@@ -152,8 +152,8 @@ public:
|
||||
|
||||
private:
|
||||
// types
|
||||
typedef std::vector<opengl_material> material_sequence;
|
||||
typedef std::unordered_map<std::string, std::size_t> index_map;
|
||||
using material_sequence = std::vector<opengl_material>;
|
||||
using index_map = std::unordered_map<std::string, std::size_t>;
|
||||
// methods:
|
||||
// checks whether specified texture is in the texture bank. returns texture id, or npos.
|
||||
material_handle
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
update();
|
||||
|
||||
// types
|
||||
typedef std::vector<light_record> lightrecord_array;
|
||||
using lightrecord_array = std::vector<light_record>;
|
||||
|
||||
// members
|
||||
lightrecord_array data;
|
||||
|
||||
@@ -41,7 +41,7 @@ private:
|
||||
bool is_good{ false }; // true if local content of the chunk matches the data on the opengl end
|
||||
};
|
||||
|
||||
typedef std::vector<chunk_record> chunkrecord_sequence;
|
||||
using chunkrecord_sequence = std::vector<chunk_record>;
|
||||
|
||||
// methods:
|
||||
// create() subclass details
|
||||
|
||||
@@ -36,7 +36,7 @@ opengl33_precipitation::create( int const Tesselation ) {
|
||||
std::uint16_t index = 0;
|
||||
|
||||
// auto const radius { 25.f }; // cylinder radius
|
||||
std::vector<float> radii { 25.f, 10.f, 5.f, 1.f };
|
||||
std::vector radii { 25.f, 10.f, 5.f, 1.f };
|
||||
for( auto radius : radii ) {
|
||||
|
||||
for( int i = 0; i <= latitudes; ++i ) {
|
||||
|
||||
@@ -61,7 +61,7 @@ bool opengl33_renderer::Init(GLFWwindow *Window)
|
||||
glEnable( GL_DEBUG_OUTPUT_SYNCHRONOUS );
|
||||
glDebugMessageControl( GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_NOTIFICATION, 0, nullptr, GL_FALSE );
|
||||
glDebugMessageControl( GL_DONT_CARE, GL_DEBUG_TYPE_PERFORMANCE, GL_DONT_CARE, 0, nullptr, GL_FALSE );
|
||||
glDebugMessageCallback( ErrorCallback, 0 );
|
||||
glDebugMessageCallback( ErrorCallback, nullptr );
|
||||
}
|
||||
|
||||
if (!Init_caps())
|
||||
|
||||
@@ -252,7 +252,7 @@ class opengl33_renderer : public gfx_renderer {
|
||||
|
||||
viewport_config *m_current_viewport = nullptr;
|
||||
|
||||
typedef std::vector<opengl33_light> opengllight_array;
|
||||
using opengllight_array = std::vector<opengl33_light>;
|
||||
|
||||
// methods
|
||||
std::unique_ptr<gl::program> make_shader(std::string v, std::string f);
|
||||
|
||||
@@ -90,7 +90,7 @@ private:
|
||||
};
|
||||
|
||||
enum stack_mode { gl_modelview = 0, gl_projection = 1, gl_texture = 2 };
|
||||
typedef std::vector<opengl_stack> openglstack_array;
|
||||
using openglstack_array = std::vector<opengl_stack>;
|
||||
|
||||
public:
|
||||
// constructors:
|
||||
|
||||
@@ -39,7 +39,7 @@ opengl_precipitation::create( int const Tesselation ) {
|
||||
std::uint16_t index = 0;
|
||||
|
||||
// auto const radius { 25.f }; // cylinder radius
|
||||
std::vector<float> radii { 25.f, 10.f, 5.f, 1.f };
|
||||
std::vector radii { 25.f, 10.f, 5.f, 1.f };
|
||||
for( auto radius : radii ) {
|
||||
|
||||
for( int i = 0; i <= latitudes; ++i ) {
|
||||
|
||||
@@ -128,7 +128,7 @@ opengl_renderer::Init( GLFWwindow *Window ) {
|
||||
// texture
|
||||
::glGenTextures( 1, &m_picktexture );
|
||||
::glBindTexture( GL_TEXTURE_2D, m_picktexture );
|
||||
::glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, EU07_PICKBUFFERSIZE, EU07_PICKBUFFERSIZE, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL );
|
||||
::glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, EU07_PICKBUFFERSIZE, EU07_PICKBUFFERSIZE, 0, GL_BGRA, GL_UNSIGNED_BYTE, nullptr );
|
||||
::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
|
||||
::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
|
||||
::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
||||
@@ -163,7 +163,7 @@ opengl_renderer::Init( GLFWwindow *Window ) {
|
||||
::glGenTextures( 1, &m_shadowtexture );
|
||||
::glBindTexture( GL_TEXTURE_2D, m_shadowtexture );
|
||||
// allocate memory
|
||||
::glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, m_shadowbuffersize, m_shadowbuffersize, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL );
|
||||
::glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, m_shadowbuffersize, m_shadowbuffersize, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, nullptr );
|
||||
// setup parameters
|
||||
::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
|
||||
::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
|
||||
@@ -178,7 +178,7 @@ opengl_renderer::Init( GLFWwindow *Window ) {
|
||||
::glGenTextures( 1, &m_shadowdebugtexture );
|
||||
::glBindTexture( GL_TEXTURE_2D, m_shadowdebugtexture );
|
||||
// allocate memory
|
||||
::glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, m_shadowbuffersize, m_shadowbuffersize, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL );
|
||||
::glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, m_shadowbuffersize, m_shadowbuffersize, 0, GL_BGRA, GL_UNSIGNED_BYTE, nullptr );
|
||||
// setup parameters
|
||||
::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
|
||||
::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
|
||||
@@ -216,7 +216,7 @@ opengl_renderer::Init( GLFWwindow *Window ) {
|
||||
::glGenTextures( 1, &m_cabshadowtexture );
|
||||
::glBindTexture( GL_TEXTURE_2D, m_cabshadowtexture );
|
||||
// allocate memory
|
||||
::glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, m_shadowbuffersize / 2, m_shadowbuffersize / 2, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL );
|
||||
::glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, m_shadowbuffersize / 2, m_shadowbuffersize / 2, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, nullptr );
|
||||
// setup parameters
|
||||
::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
|
||||
::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
|
||||
@@ -231,7 +231,7 @@ opengl_renderer::Init( GLFWwindow *Window ) {
|
||||
::glGenTextures( 1, &m_cabshadowdebugtexture );
|
||||
::glBindTexture( GL_TEXTURE_2D, m_cabshadowdebugtexture );
|
||||
// allocate memory
|
||||
::glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, m_shadowbuffersize / 2, m_shadowbuffersize / 2, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL );
|
||||
::glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, m_shadowbuffersize / 2, m_shadowbuffersize / 2, 0, GL_BGRA, GL_UNSIGNED_BYTE, nullptr );
|
||||
// setup parameters
|
||||
::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
|
||||
::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
|
||||
@@ -270,7 +270,7 @@ opengl_renderer::Init( GLFWwindow *Window ) {
|
||||
::glBindTexture( GL_TEXTURE_CUBE_MAP, m_environmentcubetexture );
|
||||
// allocate space
|
||||
for( GLuint faceindex = GL_TEXTURE_CUBE_MAP_POSITIVE_X; faceindex < GL_TEXTURE_CUBE_MAP_POSITIVE_X + 6; ++faceindex ) {
|
||||
::glTexImage2D( faceindex, 0, GL_RGBA8, EU07_ENVIRONMENTBUFFERSIZE, EU07_ENVIRONMENTBUFFERSIZE, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL );
|
||||
::glTexImage2D( faceindex, 0, GL_RGBA8, EU07_ENVIRONMENTBUFFERSIZE, EU07_ENVIRONMENTBUFFERSIZE, 0, GL_BGRA, GL_UNSIGNED_BYTE, nullptr );
|
||||
}
|
||||
// setup parameters
|
||||
::glTexParameteri( GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
|
||||
@@ -184,7 +184,7 @@ private:
|
||||
bool reflections { false };
|
||||
};
|
||||
|
||||
typedef std::vector<opengl_light> opengllight_array;
|
||||
using opengllight_array = std::vector<opengl_light>;
|
||||
|
||||
// methods
|
||||
void
|
||||
|
||||
@@ -142,7 +142,7 @@ void render_task::run()
|
||||
}
|
||||
else
|
||||
{
|
||||
std::lock_guard guard(m_target->mutex);
|
||||
std::scoped_lock guard(m_target->mutex);
|
||||
|
||||
if (m_target->image.size() != expectedBytes)
|
||||
m_target->image.resize(expectedBytes);
|
||||
@@ -362,7 +362,7 @@ void python_taskqueue::exit()
|
||||
// document intent. clearing the deque also actually releases the tasks,
|
||||
// which the previous code did not do (cancel() is a no-op stub).
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_tasks.mutex);
|
||||
std::scoped_lock lock(m_tasks.mutex);
|
||||
for (auto &task : m_tasks.data)
|
||||
{
|
||||
task->cancel();
|
||||
@@ -370,7 +370,7 @@ void python_taskqueue::exit()
|
||||
m_tasks.data.clear();
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_uploadtasks.mutex);
|
||||
std::scoped_lock lock(m_uploadtasks.mutex);
|
||||
m_uploadtasks.data.clear();
|
||||
}
|
||||
// reclaim cached python objects while the interpreter is still alive,
|
||||
@@ -394,7 +394,7 @@ void python_taskqueue::exit()
|
||||
auto python_taskqueue::insert(task_request const &Task) -> bool
|
||||
{
|
||||
|
||||
if (!m_initialized || false == Global.python_enabled || Task.renderer.empty() || Task.input == nullptr || Task.target == 0)
|
||||
if (!m_initialized || false == Global.python_enabled || Task.renderer.empty() || Task.input == nullptr || Task.target == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -409,7 +409,7 @@ auto python_taskqueue::insert(task_request const &Task) -> bool
|
||||
bool newtaskinserted{false};
|
||||
// acquire a lock on the task queue and add the new task
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_tasks.mutex);
|
||||
std::scoped_lock lock(m_tasks.mutex);
|
||||
// check the task list for a pending request with the same target
|
||||
for (auto &task : m_tasks.data)
|
||||
{
|
||||
@@ -554,7 +554,7 @@ void python_taskqueue::run(GLFWwindow *Context, rendertask_sequence &Tasks, uplo
|
||||
task = nullptr;
|
||||
// acquire a lock on the task queue and potentially grab a task from it
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(Tasks.mutex);
|
||||
std::scoped_lock lock(Tasks.mutex);
|
||||
if (false == Tasks.data.empty())
|
||||
{
|
||||
// fifo
|
||||
@@ -573,7 +573,7 @@ void python_taskqueue::run(GLFWwindow *Context, rendertask_sequence &Tasks, uplo
|
||||
task->upload();
|
||||
else
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(Upload_Tasks.mutex);
|
||||
std::scoped_lock lock(Upload_Tasks.mutex);
|
||||
Upload_Tasks.data.push_back(task);
|
||||
}
|
||||
if (PyErr_Occurred() != nullptr)
|
||||
@@ -608,7 +608,7 @@ void python_taskqueue::run(GLFWwindow *Context, rendertask_sequence &Tasks, uplo
|
||||
|
||||
void python_taskqueue::update()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_uploadtasks.mutex);
|
||||
std::scoped_lock lock(m_uploadtasks.mutex);
|
||||
|
||||
for (auto &task : m_uploadtasks.data)
|
||||
task->upload();
|
||||
|
||||
@@ -121,7 +121,7 @@ void python_screen_viewer::threadfunc()
|
||||
int format, components, width, height;
|
||||
|
||||
if (!Global.python_sharectx) {
|
||||
std::lock_guard<std::mutex> guard(m_rt->mutex);
|
||||
std::scoped_lock guard(m_rt->mutex);
|
||||
|
||||
if (window->timestamp == m_rt->timestamp)
|
||||
continue;
|
||||
|
||||
@@ -180,7 +180,7 @@ void WriteLog(std::string_view str, logtype type, bool isError)
|
||||
|
||||
const auto message = FormatLogMessage(str);
|
||||
|
||||
std::lock_guard<std::mutex> lock(logMutex);
|
||||
std::scoped_lock lock(logMutex);
|
||||
InfoStack.push_back({message, isError});
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ void ErrorLog(std::string_view str, logtype type)
|
||||
|
||||
const auto message = FormatLogMessage(str);
|
||||
|
||||
std::lock_guard<std::mutex> lock(logMutex);
|
||||
std::scoped_lock lock(logMutex);
|
||||
ErrorStack.push_back(message);
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ crash_reporter::crash_reporter()
|
||||
|
||||
database = crashpad::CrashReportDatabase::Initialize(db);
|
||||
|
||||
if (database == nullptr || database->GetSettings() == NULL)
|
||||
if (database == nullptr || database->GetSettings() == nullptr)
|
||||
return;
|
||||
|
||||
std::vector<crashpad::CrashReportDatabase::Report> reports;
|
||||
|
||||
@@ -119,7 +119,7 @@ class cParser //: public std::stringstream
|
||||
std::size_t mLine { 0 }; // currently processed line
|
||||
bool mIncFile { false }; // the parser is processing an *.inc file
|
||||
bool mFirstToken { true }; // processing first token in the current file; helper used when checking for utf bom
|
||||
typedef std::map<std::string, std::string> commentmap;
|
||||
using commentmap = std::map<std::string, std::string>;
|
||||
commentmap mComments {
|
||||
commentmap::value_type( "/*", "*/" ),
|
||||
commentmap::value_type( "//", "\n" ) };
|
||||
|
||||
@@ -127,14 +127,14 @@ bool ClearFlag(int &Flag, int const Value)
|
||||
double Random(double min, double max)
|
||||
{
|
||||
if (max < min) { std::swap(min, max); } // std::uniform_real_distribution requires min <= max (inverted bounds are UB)
|
||||
std::uniform_real_distribution<double> dist(min, max);
|
||||
std::uniform_real_distribution dist(min, max);
|
||||
return dist(Global.random_engine);
|
||||
}
|
||||
|
||||
int Random(int min, int max)
|
||||
{
|
||||
if (max < min) { std::swap(min, max); } // std::uniform_int_distribution requires min <= max (inverted bounds are UB)
|
||||
std::uniform_int_distribution<int> dist(min, max);
|
||||
std::uniform_int_distribution dist(min, max);
|
||||
return dist(Global.random_engine);
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ std::uint32_t seed_of(std::string const &Text)
|
||||
|
||||
std::string generate_uuid_v4()
|
||||
{
|
||||
std::uniform_int_distribution<int> dist(0, 255);
|
||||
std::uniform_int_distribution dist(0, 255);
|
||||
|
||||
std::array<uint8_t, 16> bytes;
|
||||
for (auto &b : bytes)
|
||||
@@ -203,7 +203,7 @@ std::string generate_uuid_v4()
|
||||
double LocalRandom(double a, double b)
|
||||
{
|
||||
if (b < a) { std::swap(a, b); } // std::uniform_real_distribution requires a <= b (inverted bounds are UB)
|
||||
std::uniform_real_distribution<double> dist(a, b);
|
||||
std::uniform_real_distribution dist(a, b);
|
||||
return dist(Global.local_random_engine);
|
||||
}
|
||||
|
||||
|
||||
@@ -419,12 +419,12 @@ class condition_variable
|
||||
// methods
|
||||
void wait()
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
std::unique_lock lock(m_mutex);
|
||||
m_condition.wait(lock, [this]() { return m_spurious == false; });
|
||||
}
|
||||
template <class Rep_, class Period_> void wait_for(const std::chrono::duration<Rep_, Period_> &Time)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
std::unique_lock lock(m_mutex);
|
||||
m_condition.wait_for(lock, Time, [this]() { return m_spurious == false; });
|
||||
}
|
||||
void notify_one()
|
||||
@@ -439,7 +439,7 @@ class condition_variable
|
||||
}
|
||||
void spurious(bool const Spurious)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
std::scoped_lock lock(m_mutex);
|
||||
m_spurious = Spurious;
|
||||
}
|
||||
|
||||
|
||||
@@ -7036,7 +7036,7 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
||||
m_powertrainsounds.position( enginelocation );
|
||||
// other engine compartment sounds
|
||||
auto const nullvector { glm::vec3() };
|
||||
std::vector<sound_source *> enginesounds = {
|
||||
std::vector enginesounds = {
|
||||
&sConverter, &sBRVent, &sCompressor, &sCompressorIdle, &sSmallCompressor, &sHeater, &m_batterysound
|
||||
};
|
||||
for( auto sound : enginesounds ) {
|
||||
@@ -8054,7 +8054,7 @@ void
|
||||
TDynamicObject::powertrain_sounds::position( glm::vec3 const Location ) {
|
||||
|
||||
auto const nullvector { glm::vec3() };
|
||||
std::vector<sound_source *> enginesounds = {
|
||||
std::vector enginesounds = {
|
||||
&inverter,
|
||||
&motor_relay, &dsbWejscie_na_bezoporow, &motor_parallel, &motor_shuntfield, &rsWentylator,
|
||||
&engine, &engine_ignition, &engine_shutdown, &engine_revving, &engine_turbo, &oil_pump, &fuel_pump, &water_pump, &water_heater, &radiator_fan, &radiator_fan_aux,
|
||||
|
||||
@@ -43,7 +43,7 @@ int const ANIM_TYPES = 10; // Ra: ilość typów animacji
|
||||
|
||||
class TAnim;
|
||||
//typedef void(__closure *TUpdate)(TAnim *pAnim); // typ funkcji aktualizującej położenie submodeli
|
||||
typedef std::function<void(TAnim *)> TUpdate; // __closure is Borland-specific extension
|
||||
using TUpdate = std::function<void(TAnim *)>; // __closure is Borland-specific extension
|
||||
|
||||
// McZapkie-250202
|
||||
int const MaxAxles = 16; // ABu 280105: zmienione z 8 na 16
|
||||
|
||||
@@ -76,7 +76,7 @@ void TGauge::Init(TSubModel *Submodel, TSubModel *Submodelon, TGaugeAnimation Ty
|
||||
auto const nulloffset { glm::vec3{} };
|
||||
auto const offset { model_offset() };
|
||||
{
|
||||
std::vector<sound_source *> soundfxs = {
|
||||
std::vector soundfxs = {
|
||||
&m_soundfxincrease,
|
||||
&m_soundfxdecrease,
|
||||
&m_soundfxon,
|
||||
|
||||
@@ -59,7 +59,7 @@ private:
|
||||
};
|
||||
|
||||
class control_mapper {
|
||||
typedef std::unordered_map< TSubModel const *, std::string> submodelstring_map;
|
||||
using submodelstring_map = std::unordered_map< TSubModel const *, std::string>;
|
||||
submodelstring_map m_controlnames;
|
||||
using stringset = std::unordered_set<std::string>;
|
||||
stringset m_names; // names of registered controls
|
||||
@@ -142,7 +142,7 @@ class TTrain {
|
||||
bool deserialize_mapping( cParser &Input );
|
||||
};
|
||||
|
||||
typedef std::vector<screen_entry> screenentry_sequence;
|
||||
using screenentry_sequence = std::vector<screen_entry>;
|
||||
|
||||
// methods
|
||||
bool CabChange(int iDirection);
|
||||
@@ -181,8 +181,8 @@ class TTrain {
|
||||
|
||||
private:
|
||||
// types
|
||||
typedef void( *command_handler )( TTrain *Train, command_data const &Command );
|
||||
typedef std::unordered_map<user_command, command_handler> commandhandler_map;
|
||||
using command_handler = void (*)( TTrain *Train, command_data const &Command );
|
||||
using commandhandler_map = std::unordered_map<user_command, command_handler>;
|
||||
// methods
|
||||
// clears state of all cabin controls
|
||||
void clear_cab_controls();
|
||||
|
||||
@@ -90,7 +90,7 @@ void ui::cameraview_panel::render_contents()
|
||||
texture->bind(0);
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
std::scoped_lock lock(mutex);
|
||||
if (image_ptr) {
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
@@ -142,7 +142,7 @@ void ui::cameraview_panel::capture_func()
|
||||
|
||||
bufpos = 0;
|
||||
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
std::scoped_lock lock(mutex);
|
||||
image_ptr = read_buffer;
|
||||
read_buffer = active_buffer;
|
||||
active_buffer = image_ptr;
|
||||
@@ -151,7 +151,7 @@ void ui::cameraview_panel::capture_func()
|
||||
notify_var.notify_one();
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
std::scoped_lock lock(mutex);
|
||||
image_ptr = nullptr;
|
||||
delete[] read_buffer;
|
||||
delete[] active_buffer;
|
||||
@@ -181,7 +181,7 @@ void ui::cameraview_panel::record_func()
|
||||
while (record_state == RUNNING) {
|
||||
if (bufpos == frame_size)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(mutex);
|
||||
std::unique_lock lock(mutex);
|
||||
auto r = notify_var.wait_for(lock, std::chrono::milliseconds(50), [this, last_cnt]{return last_cnt != frame_cnt;});
|
||||
last_cnt = frame_cnt;
|
||||
if (!image_ptr || !r)
|
||||
|
||||
@@ -2520,7 +2520,7 @@ event_manager::InitEvents() {
|
||||
void
|
||||
event_manager::InitLaunchers() {
|
||||
|
||||
std::vector<basic_table<TEventLauncher> *> launchertables {
|
||||
std::vector launchertables {
|
||||
&m_inputdrivenlaunchers,
|
||||
&m_radiodrivenlaunchers
|
||||
};
|
||||
|
||||
@@ -42,7 +42,7 @@ struct TMTableLine
|
||||
sound_source name_sound{ sound_placement::engine };
|
||||
};
|
||||
|
||||
typedef TMTableLine TMTable[MaxTTableSize + 1];
|
||||
using TMTable = TMTableLine[MaxTTableSize + 1];
|
||||
|
||||
// typedef TTrainParameters *PTrainParameters;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user