From b8c9724ca3c44cde3e3191e86b3703659dc48bfe Mon Sep 17 00:00:00 2001 From: jerrrrycho Date: Sun, 27 Sep 2026 19:31:00 +0200 Subject: [PATCH] refactor: change typedef, nullptr, scoped_lock and others --- Console/LPT.cpp | 4 +- McZapkie/MOVER.h | 16 +-- McZapkie/hamulce.h | 2 +- application/driverhints.cpp | 200 +++++++++++++------------- application/editormode.cpp | 2 +- application/scenarioloaderuilayer.cpp | 2 +- audio/sound.cpp | 4 +- editor/editorTerrainStreamer.cpp | 2 +- gl/framebuffer.cpp | 4 +- gl/pbo.cpp | 2 +- gl/shader.cpp | 6 +- global_include/interfaces/ITexture.h | 2 +- input/command.h | 6 +- input/drivermouseinput.h | 2 +- input/messaging.cpp | 2 +- model/AnimModel.cpp | 4 +- model/MdlMngr.h | 4 +- model/Texture.h | 8 +- model/material.h | 4 +- rendering/lightarray.h | 2 +- rendering/opengl33geometrybank.h | 2 +- rendering/opengl33precipitation.cpp | 2 +- rendering/opengl33renderer.cpp | 2 +- rendering/opengl33renderer.h | 2 +- rendering/openglmatrixstack.h | 2 +- rendering/openglprecipitation.cpp | 2 +- rendering/openglrenderer.cpp | 12 +- rendering/openglrenderer.h | 2 +- scripting/PyInt.cpp | 16 +-- scripting/pythonscreenviewer.cpp | 2 +- utilities/Logs.cpp | 4 +- utilities/crashreporter.cpp | 2 +- utilities/parser.h | 2 +- utilities/utilities.cpp | 8 +- utilities/utilities.h | 6 +- vehicle/DynObj.cpp | 4 +- vehicle/DynObj.h | 2 +- vehicle/Gauge.cpp | 2 +- vehicle/Train.h | 8 +- widgets/cameraview_extcam.cpp | 8 +- world/Event.cpp | 2 +- world/mtable.h | 2 +- 42 files changed, 186 insertions(+), 186 deletions(-) diff --git a/Console/LPT.cpp b/Console/LPT.cpp index c7be8275..623e22bf 100644 --- a/Console/LPT.cpp +++ b/Console/LPT.cpp @@ -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; diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index a6658494..d2b61886 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -764,7 +764,7 @@ enum class TLocalBrake HydraulicBrake }; /// Brake delay parameter table (apply/release for passenger and freight). -typedef double TBrakeDelayTable[4]; +using TBrakeDelayTable = double[4]; /// One row of the brake pressure / pipe pressure / flow-speed table for a brake handle position. struct TBrakePressure @@ -780,7 +780,7 @@ struct TBrakePressure }; /// Brake pressure table indexed by handle position. -typedef std::map TBrakePressureTable; +using TBrakePressureTable = std::map; /// Engine / drive type. 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 { diff --git a/McZapkie/hamulce.h b/McZapkie/hamulce.h index a05a3635..3c190f41 100644 --- a/McZapkie/hamulce.h +++ b/McZapkie/hamulce.h @@ -275,7 +275,7 @@ class TReservoir }; /// Pointer typedef for a reservoir instance. -typedef TReservoir *PReservoir; +using PReservoir = TReservoir *; /// /// Brake cylinder reservoir — overrides pressure functions to model the diff --git a/application/driverhints.cpp b/application/driverhints.cpp index afa654cf..04864a2e 100644 --- a/application/driverhints.cpp +++ b/application/driverhints.cpp @@ -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(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( 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( 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; } diff --git a/application/editormode.cpp b/application/editormode.cpp index 46a8edad..542e7b04 100644 --- a/application/editormode.cpp +++ b/application/editormode.cpp @@ -1131,7 +1131,7 @@ void editor_mode::capture_terrain() float const cellsize = static_cast(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::max(); bool found = false; for (auto const &t : tris) diff --git a/application/scenarioloaderuilayer.cpp b/application/scenarioloaderuilayer.cpp index c4e7df3d..cd137458 100644 --- a/application/scenarioloaderuilayer.cpp +++ b/application/scenarioloaderuilayer.cpp @@ -103,7 +103,7 @@ std::vector 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; ) diff --git a/audio/sound.cpp b/audio/sound.cpp index 0ff2eff9..f963258b 100644 --- a/audio/sound.cpp +++ b/audio/sound.cpp @@ -400,7 +400,7 @@ sound_source::play_basic() { // dispatch appropriate sound if( true == m_playbeginning && sound(sound_id::begin).buffer != null_handle) { - std::vector 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 sounds { Sound }; + std::vector sounds { Sound }; return insert( std::begin( sounds ), std::end( sounds ) ); } diff --git a/editor/editorTerrainStreamer.cpp b/editor/editorTerrainStreamer.cpp index 6d45ef34..9b4f776b 100644 --- a/editor/editorTerrainStreamer.cpp +++ b/editor/editorTerrainStreamer.cpp @@ -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(std::lround((X - x0) / cs)); int iz = static_cast(std::lround((Z - z0) / cs)); ix = std::clamp(ix, 0, cells); diff --git a/gl/framebuffer.cpp b/gl/framebuffer.cpp index af1f63de..898c8e07 100644 --- a/gl/framebuffer.cpp +++ b/gl/framebuffer.cpp @@ -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); } diff --git a/gl/pbo.cpp b/gl/pbo.cpp index 6923e09d..4cad2c9d 100644 --- a/gl/pbo.cpp +++ b/gl/pbo.cpp @@ -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(); diff --git a/gl/shader.cpp b/gl/shader.cpp index 5d818833..7815a470 100644 --- a/gl/shader.cpp +++ b/gl/shader.cpp @@ -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)); } diff --git a/global_include/interfaces/ITexture.h b/global_include/interfaces/ITexture.h index 8a1a6796..8f706033 100644 --- a/global_include/interfaces/ITexture.h +++ b/global_include/interfaces/ITexture.h @@ -1,6 +1,6 @@ #pragma once -typedef int texture_handle; +using texture_handle = int; #define null_handle (0) diff --git a/input/command.h b/input/command.h index 7ff5b272..1d963289 100644 --- a/input/command.h +++ b/input/command.h @@ -455,8 +455,8 @@ class command_queue { public: // types - typedef std::deque commanddata_sequence; - typedef std::unordered_map commands_map; + using commanddata_sequence = std::deque; + using commands_map = std::unordered_map; // methods // posts specified command for specified recipient into m_intercept_queue void @@ -511,7 +511,7 @@ void add_to_dequemap(std::unordered_map> &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 commanddescription_sequence; +using commanddescription_sequence = std::vector; extern command_queue Commands; // TODO: add name to command map, and wrap these two into helper object diff --git a/input/drivermouseinput.h b/input/drivermouseinput.h index 142ef99c..c64797c5 100644 --- a/input/drivermouseinput.h +++ b/input/drivermouseinput.h @@ -84,7 +84,7 @@ private: user_command down; }; - typedef std::unordered_map buttonbindings_map; + using buttonbindings_map = std::unordered_map; // methods void diff --git a/input/messaging.cpp b/input/messaging.cpp index 36ed853c..754defb4 100644 --- a/input/messaging.cpp +++ b/input/messaging.cpp @@ -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()); diff --git a/model/AnimModel.cpp b/model/AnimModel.cpp index bc2d6e84..f908a720 100644 --- a/model/AnimModel.cpp +++ b/model/AnimModel.cpp @@ -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; } //--------------------------------------------------------------------------- diff --git a/model/MdlMngr.h b/model/MdlMngr.h index 94baf3d4..1424f08d 100644 --- a/model/MdlMngr.h +++ b/model/MdlMngr.h @@ -26,8 +26,8 @@ public: private: // types: - typedef std::deque modelcontainer_sequence; - typedef std::unordered_map stringmodelcontainerindex_map; + using modelcontainer_sequence = std::deque; + using stringmodelcontainerindex_map = std::unordered_map; // members: static modelcontainer_sequence m_models; static stringmodelcontainerindex_map m_modelsmap; diff --git a/model/Texture.h b/model/Texture.h index 1f582640..1b7ffb54 100644 --- a/model/Texture.h +++ b/model/Texture.h @@ -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 index_map; + using index_map = std::unordered_map; // methods: // checks whether specified texture is in the texture bank. returns texture id, or npos. diff --git a/model/material.h b/model/material.h index 7e04514c..3dfb0489 100644 --- a/model/material.h +++ b/model/material.h @@ -152,8 +152,8 @@ public: private: // types - typedef std::vector material_sequence; - typedef std::unordered_map index_map; + using material_sequence = std::vector; + using index_map = std::unordered_map; // methods: // checks whether specified texture is in the texture bank. returns texture id, or npos. material_handle diff --git a/rendering/lightarray.h b/rendering/lightarray.h index 670cbea8..fb731fa3 100644 --- a/rendering/lightarray.h +++ b/rendering/lightarray.h @@ -36,7 +36,7 @@ public: update(); // types - typedef std::vector lightrecord_array; + using lightrecord_array = std::vector; // members lightrecord_array data; diff --git a/rendering/opengl33geometrybank.h b/rendering/opengl33geometrybank.h index f5cd7e37..d22c5b42 100644 --- a/rendering/opengl33geometrybank.h +++ b/rendering/opengl33geometrybank.h @@ -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 chunkrecord_sequence; + using chunkrecord_sequence = std::vector; // methods: // create() subclass details diff --git a/rendering/opengl33precipitation.cpp b/rendering/opengl33precipitation.cpp index e31eb25f..b1827afe 100644 --- a/rendering/opengl33precipitation.cpp +++ b/rendering/opengl33precipitation.cpp @@ -36,7 +36,7 @@ opengl33_precipitation::create( int const Tesselation ) { std::uint16_t index = 0; // auto const radius { 25.f }; // cylinder radius - std::vector 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 ) { diff --git a/rendering/opengl33renderer.cpp b/rendering/opengl33renderer.cpp index 5419bbcd..476fcf03 100644 --- a/rendering/opengl33renderer.cpp +++ b/rendering/opengl33renderer.cpp @@ -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()) diff --git a/rendering/opengl33renderer.h b/rendering/opengl33renderer.h index 6fda37c3..77563752 100644 --- a/rendering/opengl33renderer.h +++ b/rendering/opengl33renderer.h @@ -252,7 +252,7 @@ class opengl33_renderer : public gfx_renderer { viewport_config *m_current_viewport = nullptr; - typedef std::vector opengllight_array; + using opengllight_array = std::vector; // methods std::unique_ptr make_shader(std::string v, std::string f); diff --git a/rendering/openglmatrixstack.h b/rendering/openglmatrixstack.h index 9ba2fa41..ea3be535 100644 --- a/rendering/openglmatrixstack.h +++ b/rendering/openglmatrixstack.h @@ -90,7 +90,7 @@ private: }; enum stack_mode { gl_modelview = 0, gl_projection = 1, gl_texture = 2 }; -typedef std::vector openglstack_array; +using openglstack_array = std::vector; public: // constructors: diff --git a/rendering/openglprecipitation.cpp b/rendering/openglprecipitation.cpp index fc93b2a9..acf24687 100644 --- a/rendering/openglprecipitation.cpp +++ b/rendering/openglprecipitation.cpp @@ -39,7 +39,7 @@ opengl_precipitation::create( int const Tesselation ) { std::uint16_t index = 0; // auto const radius { 25.f }; // cylinder radius - std::vector 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 ) { diff --git a/rendering/openglrenderer.cpp b/rendering/openglrenderer.cpp index 1da66ba5..ee725dc4 100644 --- a/rendering/openglrenderer.cpp +++ b/rendering/openglrenderer.cpp @@ -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 ); diff --git a/rendering/openglrenderer.h b/rendering/openglrenderer.h index 820deb92..d556d22a 100644 --- a/rendering/openglrenderer.h +++ b/rendering/openglrenderer.h @@ -184,7 +184,7 @@ private: bool reflections { false }; }; - typedef std::vector opengllight_array; + using opengllight_array = std::vector; // methods void diff --git a/scripting/PyInt.cpp b/scripting/PyInt.cpp index fbbd0b80..76b0bd85 100644 --- a/scripting/PyInt.cpp +++ b/scripting/PyInt.cpp @@ -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 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 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 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 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 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 lock(m_uploadtasks.mutex); + std::scoped_lock lock(m_uploadtasks.mutex); for (auto &task : m_uploadtasks.data) task->upload(); diff --git a/scripting/pythonscreenviewer.cpp b/scripting/pythonscreenviewer.cpp index fa15e9fa..93173e38 100644 --- a/scripting/pythonscreenviewer.cpp +++ b/scripting/pythonscreenviewer.cpp @@ -121,7 +121,7 @@ void python_screen_viewer::threadfunc() int format, components, width, height; if (!Global.python_sharectx) { - std::lock_guard guard(m_rt->mutex); + std::scoped_lock guard(m_rt->mutex); if (window->timestamp == m_rt->timestamp) continue; diff --git a/utilities/Logs.cpp b/utilities/Logs.cpp index 554a77b9..bbed88ac 100644 --- a/utilities/Logs.cpp +++ b/utilities/Logs.cpp @@ -180,7 +180,7 @@ void WriteLog(std::string_view str, logtype type, bool isError) const auto message = FormatLogMessage(str); - std::lock_guard 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 lock(logMutex); + std::scoped_lock lock(logMutex); ErrorStack.push_back(message); } diff --git a/utilities/crashreporter.cpp b/utilities/crashreporter.cpp index e6f6efc4..b9aa13e1 100644 --- a/utilities/crashreporter.cpp +++ b/utilities/crashreporter.cpp @@ -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 reports; diff --git a/utilities/parser.h b/utilities/parser.h index 0cf51d8c..386b7ef4 100644 --- a/utilities/parser.h +++ b/utilities/parser.h @@ -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 commentmap; + using commentmap = std::map; commentmap mComments { commentmap::value_type( "/*", "*/" ), commentmap::value_type( "//", "\n" ) }; diff --git a/utilities/utilities.cpp b/utilities/utilities.cpp index 14e44897..ce5eee86 100644 --- a/utilities/utilities.cpp +++ b/utilities/utilities.cpp @@ -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 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 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 dist(0, 255); + std::uniform_int_distribution dist(0, 255); std::array 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 dist(a, b); + std::uniform_real_distribution dist(a, b); return dist(Global.local_random_engine); } diff --git a/utilities/utilities.h b/utilities/utilities.h index 91d74e67..6a5a4fe4 100644 --- a/utilities/utilities.h +++ b/utilities/utilities.h @@ -419,12 +419,12 @@ class condition_variable // methods void wait() { - std::unique_lock lock(m_mutex); + std::unique_lock lock(m_mutex); m_condition.wait(lock, [this]() { return m_spurious == false; }); } template void wait_for(const std::chrono::duration &Time) { - std::unique_lock 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 lock(m_mutex); + std::scoped_lock lock(m_mutex); m_spurious = Spurious; } diff --git a/vehicle/DynObj.cpp b/vehicle/DynObj.cpp index e84af613..ab336fc2 100644 --- a/vehicle/DynObj.cpp +++ b/vehicle/DynObj.cpp @@ -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 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 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, diff --git a/vehicle/DynObj.h b/vehicle/DynObj.h index c48e40e1..d3010daf 100644 --- a/vehicle/DynObj.h +++ b/vehicle/DynObj.h @@ -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 TUpdate; // __closure is Borland-specific extension +using TUpdate = std::function; // __closure is Borland-specific extension // McZapkie-250202 int const MaxAxles = 16; // ABu 280105: zmienione z 8 na 16 diff --git a/vehicle/Gauge.cpp b/vehicle/Gauge.cpp index a510b05f..a5f8ea46 100644 --- a/vehicle/Gauge.cpp +++ b/vehicle/Gauge.cpp @@ -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 soundfxs = { + std::vector soundfxs = { &m_soundfxincrease, &m_soundfxdecrease, &m_soundfxon, diff --git a/vehicle/Train.h b/vehicle/Train.h index 7627bbf8..032be69a 100644 --- a/vehicle/Train.h +++ b/vehicle/Train.h @@ -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; stringset m_names; // names of registered controls @@ -142,7 +142,7 @@ class TTrain { bool deserialize_mapping( cParser &Input ); }; - typedef std::vector screenentry_sequence; + using screenentry_sequence = std::vector; // 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 commandhandler_map; + using command_handler = void (*)( TTrain *Train, command_data const &Command ); + using commandhandler_map = std::unordered_map; // methods // clears state of all cabin controls void clear_cab_controls(); diff --git a/widgets/cameraview_extcam.cpp b/widgets/cameraview_extcam.cpp index 80deddbe..c8d78eed 100644 --- a/widgets/cameraview_extcam.cpp +++ b/widgets/cameraview_extcam.cpp @@ -90,7 +90,7 @@ void ui::cameraview_panel::render_contents() texture->bind(0); { - std::lock_guard 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 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 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 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) diff --git a/world/Event.cpp b/world/Event.cpp index 4e042b29..fd969c48 100644 --- a/world/Event.cpp +++ b/world/Event.cpp @@ -2520,7 +2520,7 @@ event_manager::InitEvents() { void event_manager::InitLaunchers() { - std::vector *> launchertables { + std::vector launchertables { &m_inputdrivenlaunchers, &m_radiodrivenlaunchers }; diff --git a/world/mtable.h b/world/mtable.h index c58d120f..06595ef0 100644 --- a/world/mtable.h +++ b/world/mtable.h @@ -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;