diff --git a/Console.h b/Console.h index e99beb4b..1f7f9e2b 100644 --- a/Console.h +++ b/Console.h @@ -20,7 +20,8 @@ class TLPT; class TKeyTrans { // przekodowanie kodu naciśnięcia i zwolnienia klawisza public: - short int iDown, iUp; + short int iDown; + short int iUp; }; class Console diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index ff60c27c..9c6e6821 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -289,8 +289,11 @@ double TMoverParameters::Current(double n, double U) // a takze wywala bezpiecznik nadmiarowy gdy za duzy prad lub za male napiecie // jest takze mozliwosc uszkodzenia silnika wskutek nietypowych parametrow - double R, MotorCurrent; - double Rz, Delta, Isf; + double R; + double MotorCurrent; + double Rz; + double Delta; + double Isf; double Mn; // przujmuje int, ale dla poprawnosci obliczeń double Bn; int SP = 0; @@ -609,7 +612,7 @@ bool TMoverParameters::Attach(int ConnectNo, int ConnectToNr, TMoverParameters * // jeśli wcześniej nie było połączone, ustalenie z której strony rysować sprzęg coupler.Render = true; // tego rysować othercoupler.Render = false; // a tego nie - }; + } auto const couplingchange{CouplingType ^ coupler.CouplingFlag}; coupler.Connected = ConnectTo; coupler.CouplingFlag = CouplingType; // ustawienie typu sprzęgu @@ -936,8 +939,11 @@ void TMoverParameters::UpdatePantVolume(double dt) void TMoverParameters::UpdateBatteryVoltage(double dt) { // przeliczenie obciążenia baterii - double sn1 = 0.0, sn2 = 0.0, sn3 = 0.0, sn4 = 0.0, - sn5 = 0.0; // Ra: zrobić z tego amperomierz NN + double sn1 = 0.0; + double sn2 = 0.0; + double sn3 = 0.0; + double sn4 = 0.0; + double sn5 = 0.0; // Ra: zrobić z tego amperomierz NN if (BatteryVoltage > 0 && EngineType != TEngineType::DieselEngine && EngineType != TEngineType::WheelsDriven && NominalBatteryVoltage > 0) { @@ -968,7 +974,7 @@ void TMoverParameters::UpdateBatteryVoltage(double dt) sn5 = dt * 0.001; else sn5 = 0; - }; + } if (NominalBatteryVoltage / BatteryVoltage >= 1.22 && Battery) { // 90V if (PantCompFlag) @@ -991,7 +997,7 @@ void TMoverParameters::UpdateBatteryVoltage(double dt) sn5 = dt * 0.0010; else sn5 = 0; - }; + } if (!Battery) { if (NominalBatteryVoltage / BatteryVoltage < 1.22) @@ -1002,7 +1008,7 @@ void TMoverParameters::UpdateBatteryVoltage(double dt) sn3 = dt * 0.000001; sn4 = dt * 0.000001; sn5 = dt * 0.000001; // bardzo powolny spadek przy wyłączonych bateriach - }; + } BatteryVoltage -= sn1 + sn2 + sn3 + sn4 + sn5; if (NominalBatteryVoltage / BatteryVoltage > 1.57) if (MainSwitch(false) && EngineType != TEngineType::DieselEngine && EngineType != TEngineType::WheelsDriven) @@ -1624,7 +1630,7 @@ void TMoverParameters::compute_movement_(double const Deltatime) { Compressor = 0; CompressorFlag = false; - }; + } if (VeselVolume > 0.0) { // sprężarka musi mieć jakąś niezerową wydajność żeby rozważać jej załączenie i pracę @@ -2015,7 +2021,7 @@ double TMoverParameters::ShowEngineRotation(int VehN) if (Couplers[b].Connected->Couplers[b].Connected->Power > 0.01) return fabs(Couplers[b].Connected->Couplers[b].Connected->enrot); break; - }; + } return 0.0; }; @@ -2437,7 +2443,6 @@ bool TMoverParameters::IncMainCtrl(int CtrlSpeed) while (RList[MainCtrlPos].R > 0.0 && IncMainCtrl(1)) { // all work is done in the loop header - ; } OK = false; // shouldn't this be part of the loop above? // if (TrainType=dt_ET40) then @@ -2493,7 +2498,7 @@ bool TMoverParameters::IncMainCtrl(int CtrlSpeed) { while (MainCtrlPos < MainCtrlPosNo && IncMainCtrl(1)) { - ; + // all work is done in the loop header } } else @@ -4782,7 +4787,9 @@ void TMoverParameters::UpdateScndPipePressure(double dt) const double Spz = 0.5067; TMoverParameters *c; - double dv1, dv2, dV; + double dv1; + double dv2; + double dV; UpdateSpringBrake(dt); @@ -4875,7 +4882,8 @@ double TMoverParameters::GetDVc(double dt) { // T_MoverParameters *c; TMoverParameters *c; - double dv1, dv2; // , dV; + double dv1; + double dv2; // , dV; dv1 = 0; dv2 = 0; @@ -4919,7 +4927,9 @@ double TMoverParameters::GetDVc(double dt) // ************************************************************************************************* void TMoverParameters::ComputeConstans(void) { - double BearingF, RollF, HideModifier; + double BearingF; + double RollF; + double HideModifier; double Curvature; // Ra 2014-07: odwrotność promienia TotalMassxg = TotalMass * g; // TotalMass*g @@ -5193,7 +5203,9 @@ double TMoverParameters::BrakeForceP(double press, double velocity) double TMoverParameters::BrakeForce(TTrackParam const &Track) { - double K{0}, Fb{0}, sm{0}; + double K{0}; + double Fb{0}; + double sm{0}; switch (LocalBrake) { @@ -5491,7 +5503,10 @@ double TMoverParameters::CouplerForce(int const End, double dt) // ************************************************************************************************* double TMoverParameters::TractionForce(double dt) { - double PosRatio, dmoment, dtrans, tmp; + double PosRatio; + double dmoment; + double dtrans; + double tmp; Ft = 0; dtrans = 0; @@ -6579,7 +6594,8 @@ double TMoverParameters::TractionForce(double dt) // ************************************************************************************************* double TMoverParameters::ComputeRotatingWheel(double WForce, double dt, double n) const { - double newn = 0, eps = 0; + double newn = 0; + double eps = 0; if (n == 0 && WForce * Sign(V) < 0) newn = 0; else @@ -6725,7 +6741,8 @@ double TMoverParameters::v2n(void) { // przelicza predkosc liniowa na obrotowa const double dmgn = 0.5; - double n, deltan = 0; + double n; + double deltan = 0; n = V / (M_PI * WheelDiameter); // predkosc obrotowa wynikajaca z liniowej [obr/s] deltan = n - nrot; //"pochodna" prędkości obrotowej @@ -8036,8 +8053,16 @@ double TMoverParameters::dizel_fillcheck(int mcp, double dt) // ************************************************************************************************* double TMoverParameters::dizel_Momentum(double dizel_fill, double n, double dt) { // liczy moment sily wytwarzany przez silnik spalinowy} - double Moment = 0, enMoment = 0, gearMoment = 0, eps = 0, newn = 0, friction = 0, neps = 0; - double TorqueH = 0, TorqueL = 0, TorqueC = 0; + double Moment = 0; + double enMoment = 0; + double gearMoment = 0; + double eps = 0; + double newn = 0; + double friction = 0; + double neps = 0; + double TorqueH = 0; + double TorqueL = 0; + double TorqueC = 0; n = n * CabActive; if (motor_param(ScndCtrlActualPos).mIsat < 0.001 || DirActive == 0) n = enrot; @@ -9032,10 +9057,20 @@ bool TMoverParameters::switch_physics(bool const State) // DO PRZETLUMACZENIA NA // FUNKCJE PARSERA WCZYTYWANIA PLIKU FIZYKI POJAZDU // ************************************************************************************************* bool startBPT; -bool startMPT, startMPT0; -bool startRLIST, startUCLIST; -bool startDIZELMOMENTUMLIST, startDIZELV2NMAXLIST, startHYDROTCLIST, startPMAXLIST; -bool startDLIST, startFFLIST, startWWLIST, startWiperList, startDimmerList, startFFEDLIST; +bool startMPT; +bool startMPT0; +bool startRLIST; +bool startUCLIST; +bool startDIZELMOMENTUMLIST; +bool startDIZELV2NMAXLIST; +bool startHYDROTCLIST; +bool startPMAXLIST; +bool startDLIST; +bool startFFLIST; +bool startWWLIST; +bool startWiperList; +bool startDimmerList; +bool startFFEDLIST; bool startLIGHTSLIST; bool startCOMPRESSORLIST; int LISTLINE; @@ -12795,7 +12830,8 @@ bool TMoverParameters::RunInternalCommand() // ************************************************************************************************* double TMoverParameters::ShowCurrentP(int AmpN) const { - int b, Bn; + int b; + int Bn; bool Grupowy; // ClearPendingExceptions; diff --git a/McZapkie/hamulce.cpp b/McZapkie/hamulce.cpp index 64a7fb85..3cd39f4a 100644 --- a/McZapkie/hamulce.cpp +++ b/McZapkie/hamulce.cpp @@ -674,14 +674,14 @@ double TWest::GetPF(double const PP, double const dt, double const Vel) BCP = BrakeCyl->P(); if ((BrakeStatus & b_hld) == b_hld) + { if (VVP + 0.03 < BVP) BrakeStatus |= b_on; else if (VVP > BVP + 0.1) BrakeStatus &= ~(b_on | b_hld); else if (VVP > BVP) BrakeStatus &= ~b_on; - else - ; + } else if (VVP + 0.25 < BVP) BrakeStatus |= b_on | b_hld; @@ -1168,14 +1168,14 @@ double TEStEP2::GetPF(double const PP, double const dt, double const Vel) // sprawdzanie stanu if ((BrakeStatus & b_hld) == b_hld && BCP > 0.25) + { if (VVP + 0.003 + BCP / BVM < CVP - 0.12) BrakeStatus |= b_on; // hamowanie stopniowe; else if (VVP - 0.003 + BCP / BVM > CVP - 0.12) BrakeStatus &= ~(b_on | b_hld); // luzowanie; else if (VVP + BCP / BVM > CVP - 0.12) BrakeStatus &= ~b_on; // zatrzymanie napelaniania; - else - ; + } else if (VVP + 0.10 < CVP - 0.12 && BCP < 0.25) // poczatek hamowania { // if ((BrakeStatus & 1) == 0) @@ -2165,14 +2165,14 @@ void TCV1::CheckState(double const BCP, double &dV1) // sprawdzanie stanu if ((BrakeStatus & b_hld) == b_hld) + { if (VVP + 0.003 + BCP / BVM < CVP) BrakeStatus |= b_on; // hamowanie stopniowe; else if (VVP - 0.003 + BCP * 1.0 / BVM > CVP) BrakeStatus &= ~(b_on | b_hld); // luzowanie; else if (VVP + BCP * 1.0 / BVM > CVP) BrakeStatus &= ~b_on; // zatrzymanie napelaniania; - else - ; + } else if (VVP + 0.10 < CVP && BCP < 0.1) // poczatek hamowania { BrakeStatus |= b_on | b_hld; diff --git a/application/driverhints.cpp b/application/driverhints.cpp index afa654cf..b318953c 100644 --- a/application/driverhints.cpp +++ b/application/driverhints.cpp @@ -490,7 +490,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter ) if( AIControllFlag ) { while( mvControlling->RList[mvControlling->MainCtrlPos].Mn == 0 && mvControlling->IncMainCtrl(1) ) { - ; + // all work is done in the loop header } } remove_master_controller_hints(); @@ -509,7 +509,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter ) } while( mvControlling->RList[mvControlling->MainCtrlPos].Bn > 1 && mvControlling->DecMainCtrl(1) ) { - ; // all work is performed in the header + // all work is performed in the header } } } @@ -535,7 +535,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter ) if( AIControllFlag ) { while( false == mvControlling->EIMDirectionChangeAllow() && mvControlling->DecMainCtrl(1) ) { - ; + // all work is done in the loop header } } remove_master_controller_hints(); @@ -778,7 +778,6 @@ TController::cue_action( driver_hint const Action, float const Actionparameter ) while( BrakeCtrlPosition >= mvOccupied->HandleUnlock && BrakeLevelAdd(-1) ) { // all work is done in the header - ; } } } @@ -857,7 +856,9 @@ TController::cue_action( driver_hint const Action, float const Actionparameter ) } case driver_hint::brakingforcesetzero: { // releases both train and independent brake if( AIControllFlag ) { - while( true == DecBrake() ) { ; } + while( true == DecBrake() ) { + // all work is done in the loop condition + } } remove_train_brake_hints(); hint( diff --git a/application/driveruipanels.cpp b/application/driveruipanels.cpp index 729b854c..8b71c4bf 100644 --- a/application/driveruipanels.cpp +++ b/application/driveruipanels.cpp @@ -1565,7 +1565,7 @@ debug_panel::render_section_settings() { ImGui::SliderInt( ( std::to_string( Global.gfx_shadow_rank_cutoff ) + "###shadowrankcutoff" ).c_str(), &Global.gfx_shadow_rank_cutoff, 1, 3, "Shadow ranks" ); if( ImGui::SliderFloat( ( to_string( std::abs( Global.gfx_shadow_angle_min ), 2 ) + "###shadowanglecutoff" ).c_str(), &Global.gfx_shadow_angle_min, -1.0, -0.2, "Shadow angle cutoff" ) ) { Global.gfx_shadow_angle_min = quantize( Global.gfx_shadow_angle_min, 0.05f ); - }; + } if( DebugModeFlag ) { // sky sliders { diff --git a/application/driveruipanels.h b/application/driveruipanels.h index da4cad87..fe35e1d7 100644 --- a/application/driveruipanels.h +++ b/application/driveruipanels.h @@ -106,17 +106,16 @@ private: std::array m_buffer; std::array m_eventsearch; input_data m_input; - std::vector - m_vehiclelines, - m_enginelines, - m_ailines, - m_scantablelines, - m_cameralines, - m_scenariolines, - m_eventqueuelines, - m_powergridlines, - m_rendererlines, - m_uartlines; + std::vector m_vehiclelines; + std::vector m_enginelines; + std::vector m_ailines; + std::vector m_scantablelines; + std::vector m_cameralines; + std::vector m_scenariolines; + std::vector m_eventqueuelines; + std::vector m_powergridlines; + std::vector m_rendererlines; + std::vector m_uartlines; double last_time = std::numeric_limits::quiet_NaN(); diff --git a/application/uitranscripts.cpp b/application/uitranscripts.cpp index c9780e10..bfe3f233 100644 --- a/application/uitranscripts.cpp +++ b/application/uitranscripts.cpp @@ -42,7 +42,8 @@ TTranscripts::Add( std::string const &txt, bool backgorund ) { cParser parser( asciitext ); while( true == parser.getTokens( 3, false, "[]\n" ) ) { - float begin{ 0.f }, end{ 0.f }; + float begin{ 0.f }; + float end{ 0.f }; std::string transcript; parser >> begin diff --git a/audio/sound.cpp b/audio/sound.cpp index 0ff2eff9..49f17270 100644 --- a/audio/sound.cpp +++ b/audio/sound.cpp @@ -47,7 +47,7 @@ sound_source::deserialize( cParser &Input, sound_type const Legacytype, int cons if( Input.peek() == "{" ) { // block type config while( true == deserialize_mapping( Input ) ) { - ; // all work done by while() + // all work done by while() } if( false == m_soundchunks.empty() ) { diff --git a/environment/skydome.cpp b/environment/skydome.cpp index 830eb145..42fe0c29 100644 --- a/environment/skydome.cpp +++ b/environment/skydome.cpp @@ -196,7 +196,9 @@ void CSkyDome::RebuildColors() { float zenithy = GetZenith( m_zenithymatrix, m_thetasun, m_turbidity ); // get perez function parametrs - float perezluminance[5], perezx[5], perezy[5]; + float perezluminance[5]; + float perezx[5]; + float perezy[5]; GetPerez( perezluminance, m_distributionluminance, m_turbidity ); GetPerez( perezx, m_distributionxcomp, m_turbidity ); GetPerez( perezy, m_distributionycomp, m_turbidity ); @@ -207,11 +209,13 @@ void CSkyDome::RebuildColors() { zenithluminance = PerezFunctionO1( perezluminance, m_thetasun, zenithluminance ); // start with fresh average for the new pass - glm::vec3 averagecolor, averagehorizoncolor; + glm::vec3 averagecolor; + glm::vec3 averagehorizoncolor; // trough all vertices glm::vec3 vertex; - glm::vec3 color, colorconverter; + glm::vec3 color; + glm::vec3 colorconverter; for ( unsigned int i = 0; i < m_vertices.size(); ++i ) { // grab it diff --git a/environment/skydome.h b/environment/skydome.h index 74d024d1..7ee4c9e0 100644 --- a/environment/skydome.h +++ b/environment/skydome.h @@ -35,7 +35,8 @@ public: private: // shading parametrs glm::vec3 m_sundirection; - float m_thetasun, m_phisun; + float m_thetasun; + float m_phisun; float m_turbidity; bool m_linearexpcontrol; float m_expfactor; diff --git a/input/gamepadinput.cpp b/input/gamepadinput.cpp index ac819b82..b0f26267 100644 --- a/input/gamepadinput.cpp +++ b/input/gamepadinput.cpp @@ -345,7 +345,8 @@ void gamepad_input::process_axes() { input_type inputtype; - user_command boundcommand1, boundcommand2; + user_command boundcommand1; + user_command boundcommand2; auto binding { std::tie( inputtype, boundcommand1, boundcommand2 ) }; // since some commands can potentially collect values from two different axes we can't post them directly diff --git a/launcher/launchermode.h b/launcher/launchermode.h index 53a65f4d..0a9475e3 100644 --- a/launcher/launchermode.h +++ b/launcher/launchermode.h @@ -27,10 +27,10 @@ public: void exit() override; // input handlers void on_key( int Key, int Scancode, int Action, int Mods ) override; - void on_cursor_pos( double const Horizontal, double const Vertical ) override { ; } - void on_mouse_button( int const Button, int const Action, int const Mods ) override { ; } - void on_scroll( double const Xoffset, double const Yoffset ) override { ; } + void on_cursor_pos( double const Horizontal, double const Vertical ) override { /* not handled by the launcher */ } + void on_mouse_button( int const Button, int const Action, int const Mods ) override { /* not handled by the launcher */ } + void on_scroll( double const Xoffset, double const Yoffset ) override { /* not handled by the launcher */ } void on_window_resize( int w, int h ) override; - void on_event_poll() override { ; } + void on_event_poll() override { /* not handled by the launcher */ } bool is_command_processor() const override { return false; } }; diff --git a/launcher/textures_scanner.cpp b/launcher/textures_scanner.cpp index 201ff967..f057acf1 100644 --- a/launcher/textures_scanner.cpp +++ b/launcher/textures_scanner.cpp @@ -108,7 +108,9 @@ void ui::vehicles_bank::parse_texture_info(const std::string &target, const std: { std::istringstream stream(param); - std::string model, mini, miniplus; + std::string model; + std::string mini; + std::string miniplus; std::getline(stream, model, ','); std::getline(stream, mini, ','); @@ -178,7 +180,8 @@ std::shared_ptr ui::vehicles_bank::parse_meta(const std::string & if (!meta->rev_date.empty() && meta->rev_date != "?") { std::istringstream stream(meta->rev_date); - std::string day, month; + std::string day; + std::string month; std::getline(stream, day, '.'); std::getline(stream, month, '.'); @@ -205,7 +208,8 @@ void ui::vehicles_bank::parse_coupling_rule(const std::string &target, const std std::string connected; std::getline(stream, connected, ','); - std::string param1, param2; + std::string param1; + std::string param2; std::getline(stream, param1, ','); std::getline(stream, param2, ','); @@ -232,7 +236,8 @@ void ui::vehicles_bank::parse_texture_rule(const std::string &target, const std: std::istringstream rule_stream(replace_rule); - std::string src, dst; + std::string src; + std::string dst; std::getline(rule_stream, src, '-'); std::getline(rule_stream, dst, '-'); diff --git a/rendering/flip-s3tc.h b/rendering/flip-s3tc.h index a529add4..a29fdc48 100644 --- a/rendering/flip-s3tc.h +++ b/rendering/flip-s3tc.h @@ -14,39 +14,43 @@ namespace flip_s3tc struct dxt1_block { - uint16_t c0, c1; - uint8_t dcba, - hgfe, - lkji, - ponm; + uint16_t c0; + uint16_t c1; + uint8_t dcba; + uint8_t hgfe; + uint8_t lkji; + uint8_t ponm; }; struct dxt23_block { - uint16_t adacabaa, - ahagafae, - alakajai, - apaoanam; - uint16_t c0, c1; - uint8_t dcba, - hgfe, - lkji, - ponm; + uint16_t adacabaa; + uint16_t ahagafae; + uint16_t alakajai; + uint16_t apaoanam; + uint16_t c0; + uint16_t c1; + uint8_t dcba; + uint8_t hgfe; + uint8_t lkji; + uint8_t ponm; }; struct dxt45_block { - uint8_t a0, a1; + uint8_t a0; + uint8_t a1; struct { uint8_t alpha[3]; } ahagafaeadacabaa, apaoanamalakajai; - uint16_t c0, c1; - uint8_t dcba, - hgfe, - lkji, - ponm; + uint16_t c0; + uint16_t c1; + uint8_t dcba; + uint8_t hgfe; + uint8_t lkji; + uint8_t ponm; }; #pragma pack(pop) @@ -123,8 +127,10 @@ void flip_dxt45_block(struct dxt45_block *block) */ void flip_dxt1_image(void *data, int width, int height) { - int x, y; - struct dxt1_block temp1, temp2; + int x; + int y; + struct dxt1_block temp1; + struct dxt1_block temp2; struct dxt1_block *blocks = (struct dxt1_block *)data; width = (width + 3) / 4; @@ -152,8 +158,10 @@ void flip_dxt1_image(void *data, int width, int height) */ void flip_dxt23_image(void *data, int width, int height) { - int x, y; - struct dxt23_block temp1, temp2; + int x; + int y; + struct dxt23_block temp1; + struct dxt23_block temp2; struct dxt23_block *blocks = (struct dxt23_block *)data; width = (width + 3) / 4; @@ -181,8 +189,10 @@ void flip_dxt23_image(void *data, int width, int height) */ void flip_dxt45_image(void *data, int width, int height) { - int x, y; - struct dxt45_block temp1, temp2; + int x; + int y; + struct dxt45_block temp1; + struct dxt45_block temp2; struct dxt45_block *blocks = (struct dxt45_block *)data; width = (width + 3) / 4; diff --git a/rendering/opengl33skydome.h b/rendering/opengl33skydome.h index 425c276b..287ac511 100644 --- a/rendering/opengl33skydome.h +++ b/rendering/opengl33skydome.h @@ -19,7 +19,7 @@ public: // constructors opengl33_skydome() = default; // destructor - ~opengl33_skydome() {;} + ~opengl33_skydome() = default; // methods // updates data stores on the opengl end. NOTE: unbinds buffers void update(); diff --git a/rendering/openglgeometrybank.cpp b/rendering/openglgeometrybank.cpp index ec950c0f..69ebaac0 100644 --- a/rendering/openglgeometrybank.cpp +++ b/rendering/openglgeometrybank.cpp @@ -139,9 +139,8 @@ opengl_vbogeometrybank::setup_buffer() { // may be better to initiate upload earlier (during update phase) and trust this effort won't go to waste if( true == m_chunks.empty() ) { return; } - std::size_t - vertexcount{ 0 }, - indexcount{ 0 }; + std::size_t vertexcount{ 0 }; + std::size_t indexcount{ 0 }; auto chunkiterator = m_chunks.cbegin(); for( auto &chunkrecord : m_chunkrecords ) { // fill records for all chunks, based on the chunk data diff --git a/rendering/particles.cpp b/rendering/particles.cpp index eb02bf41..d31b8d6c 100644 --- a/rendering/particles.cpp +++ b/rendering/particles.cpp @@ -81,7 +81,7 @@ smoke_source::deserialize( cParser &Input ) { if( false == Input.ok() ) { return false; } while( true == deserialize_mapping( Input ) ) { - ; // all work done by while() + // all work done by while() } return true; diff --git a/scripting/PyInt.cpp b/scripting/PyInt.cpp index fbbd0b80..53daec43 100644 --- a/scripting/PyInt.cpp +++ b/scripting/PyInt.cpp @@ -178,7 +178,8 @@ void render_task::run() for (const auto &cmd : commands) { std::string baseCmd; - int p1 = 0, p2 = 0; + int p1 = 0; + int p2 = 0; size_t pos1 = cmd.find(';'); if (pos1 == std::string::npos) @@ -636,7 +637,9 @@ void python_taskqueue::error() else { // nie dziala buffor pythona - PyObject *type, *value, *traceback; + PyObject *type; + PyObject *value; + PyObject *traceback; PyErr_Fetch(&type, &value, &traceback); if (type == nullptr) { diff --git a/scripting/ladderlogic.cpp b/scripting/ladderlogic.cpp index b86aba6f..5dcb1947 100644 --- a/scripting/ladderlogic.cpp +++ b/scripting/ladderlogic.cpp @@ -130,10 +130,9 @@ basic_controller::deserialize_operation( cParser &Input ) -> bool { cParser operationparser( operationdata, cParser::buffer_TEXT ); // HACK: operation potentially contains 1-2 parameters so we try to grab the whole set operationparser.getTokens( 3, "\t " ); - std::string - operationname, - operationelement, - operationparameter; + std::string operationname; + std::string operationelement; + std::string operationparameter; operationparser >> operationname >> operationelement diff --git a/scripting/pythonscreenviewer.cpp b/scripting/pythonscreenviewer.cpp index fa15e9fa..fcf0ffc2 100644 --- a/scripting/pythonscreenviewer.cpp +++ b/scripting/pythonscreenviewer.cpp @@ -49,7 +49,8 @@ python_screen_viewer::python_screen_viewer(std::shared_ptr rt, std::s monitor, false, Global.python_sharectx); { - int w, h; + int w; + int h; glfwGetWindowSize(conf->window, &w, &h); conf->window_size = glm::ivec2(w, h); glfwGetFramebufferSize(conf->window, &w, &h); @@ -118,7 +119,10 @@ void python_screen_viewer::threadfunc() for (auto &window : m_windows) { unsigned char *image = nullptr; - int format, components, width, height; + int format; + int components; + int width; + int height; if (!Global.python_sharectx) { std::lock_guard guard(m_rt->mutex); diff --git a/utilities/Float3d.cpp b/utilities/Float3d.cpp index 29a63456..737a8f32 100644 --- a/utilities/Float3d.cpp +++ b/utilities/Float3d.cpp @@ -33,9 +33,15 @@ void float4x4::serialize_float32(std::ostream &s) void float4x4::Quaternion(float4 *q) { // konwersja kwaternionu obrotu na macierz obrotu - float xx = q->x * q->x, yy = q->y * q->y, zz = q->z * q->z; - float xy = q->x * q->y, xz = q->x * q->z, yz = q->y * q->z; - float wx = q->w * q->x, wy = q->w * q->y, wz = q->w * q->z; + float xx = q->x * q->x; + float yy = q->y * q->y; + float zz = q->z * q->z; + float xy = q->x * q->y; + float xz = q->x * q->z; + float yz = q->y * q->z; + float wx = q->w * q->x; + float wy = q->w * q->y; + float wz = q->w * q->z; e[0] = 1.0f - yy - yy - zz - zz; e[1] = xy + xy + wz + wz; e[2] = xz + xz - wy - wy; diff --git a/utilities/Float3d.h b/utilities/Float3d.h index 1e5e9892..08b4987f 100644 --- a/utilities/Float3d.h +++ b/utilities/Float3d.h @@ -15,7 +15,9 @@ http://mozilla.org/MPL/2.0/. class float3 { // wapółrzędne wierchołka 3D o pojedynczej precyzji public: - float x, y, z; + float x; + float y; + float z; float3(void){}; float3(float a, float b, float c) { @@ -96,7 +98,10 @@ inline float3 Interpolate( float3 const &First, float3 const &Second, float cons class float4 { // kwaternion obrotu public: - float x, y, z, w; + float x; + float y; + float z; + float w; float4() { x = y = z = 0.f; @@ -177,7 +182,8 @@ inline float4 Slerp(const float4 &q0, const float4 &q1, float t) new_q1.w = -new_q1.w; cosOmega = -cosOmega; } - float k0, k1; + float k0; + float k1; if (cosOmega > 0.9999f) { // jeśli jesteśmy z (t) na maksimum kosinusa, to tam prawie liniowo jest k0 = 1.0f - t; @@ -200,7 +206,8 @@ struct float8 public: float3 Point; float3 Normal; - float tu, tv; + float tu; + float tv; }; class float4x4 @@ -345,10 +352,22 @@ inline float Det3x3(float a1, float a2, float a3, float b1, float b2, float b3, inline float Det(const float4x4 &m) { // obliczenie wyznacznika macierzy 4×4 - float a1 = m[0][0], a2 = m[1][0], a3 = m[2][0], a4 = m[3][0]; - float b1 = m[0][1], b2 = m[1][1], b3 = m[2][1], b4 = m[3][1]; - float c1 = m[0][2], c2 = m[1][2], c3 = m[2][2], c4 = m[3][2]; - float d1 = m[0][3], d2 = m[1][3], d3 = m[2][3], d4 = m[3][3]; + float a1 = m[0][0]; + float a2 = m[1][0]; + float a3 = m[2][0]; + float a4 = m[3][0]; + float b1 = m[0][1]; + float b2 = m[1][1]; + float b3 = m[2][1]; + float b4 = m[3][1]; + float c1 = m[0][2]; + float c2 = m[1][2]; + float c3 = m[2][2]; + float c4 = m[3][2]; + float d1 = m[0][3]; + float d2 = m[1][3]; + float d3 = m[2][3]; + float d4 = m[3][3]; return +a1 * Det3x3(b2, b3, b4, c2, c3, c4, d2, d3, d4) - b1 * Det3x3(a2, a3, a4, c2, c3, c4, d2, d3, d4) + c1 * Det3x3(a2, a3, a4, b2, b3, b4, d2, d3, d4) - diff --git a/utilities/Timer.cpp b/utilities/Timer.cpp index 5cc9f93a..d9ad2032 100644 --- a/utilities/Timer.cpp +++ b/utilities/Timer.cpp @@ -16,7 +16,8 @@ namespace Timer { subsystem_stopwatches subsystem; -double DeltaTime = 0.0, DeltaRenderTime = 0.0; +double DeltaTime = 0.0; +double DeltaRenderTime = 0.0; double fFPS{ 0.0f }; double fLastTime{ 0.0f }; DWORD dwFrames{ 0 }; @@ -59,7 +60,9 @@ void ResetTimers() DeltaRenderTime = 0.0; } -uint64_t fr, count, oldCount; +uint64_t fr; +uint64_t count; +uint64_t oldCount; void UpdateTimers(bool pause) { diff --git a/utilities/motiontelemetry.cpp b/utilities/motiontelemetry.cpp index 473970d7..1bfe1f36 100644 --- a/utilities/motiontelemetry.cpp +++ b/utilities/motiontelemetry.cpp @@ -28,7 +28,8 @@ motiontelemetry::motiontelemetry() throw std::runtime_error("failed to init winsock"); #endif - struct addrinfo hints, *res; + struct addrinfo hints; + struct addrinfo *res; memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; diff --git a/vehicle/AirCoupler.h b/vehicle/AirCoupler.h index 3f860e63..a502f77c 100644 --- a/vehicle/AirCoupler.h +++ b/vehicle/AirCoupler.h @@ -14,7 +14,9 @@ http://mozilla.org/MPL/2.0/. class AirCoupler { private: - TSubModel *ModelOn, *ModelOff, *ModelxOn; + TSubModel *ModelOn; + TSubModel *ModelOff; + TSubModel *ModelxOn; bool On; bool xOn; void Update(); diff --git a/vehicle/Button.cpp b/vehicle/Button.cpp index d4d31877..b6359ded 100644 --- a/vehicle/Button.cpp +++ b/vehicle/Button.cpp @@ -51,7 +51,7 @@ void TButton::Load( cParser &Parser, TDynamicObject const *Owner ) { // TODO: rework the base part into yaml-compatible flow style mapping submodelname = Parser.getToken( false ); while( true == Load_mapping( Parser ) ) { - ; // all work done by while() + // all work done by while() } } diff --git a/vehicle/Button.h b/vehicle/Button.h index e2eb38cb..d85ee209 100644 --- a/vehicle/Button.h +++ b/vehicle/Button.h @@ -48,9 +48,8 @@ private: play(); // members - TSubModel - *pModelOn { nullptr }, - *pModelOff { nullptr }; // submodel dla stanu załączonego i wyłączonego + TSubModel *pModelOn { nullptr }; + TSubModel *pModelOff { nullptr }; // submodel dla stanu załączonego i wyłączonego bool m_state { false }; bool const *bData { nullptr }; int iFeedbackBit { 0 }; // Ra: bit informacji zwrotnej, do wyprowadzenia na pulpit diff --git a/vehicle/Gauge.cpp b/vehicle/Gauge.cpp index 63c042d3..c91045e4 100644 --- a/vehicle/Gauge.cpp +++ b/vehicle/Gauge.cpp @@ -97,8 +97,13 @@ void TGauge::Init(TSubModel *Submodel, TSubModel *Submodelon, TGaugeAnimation Ty void TGauge::Load( cParser &Parser, TDynamicObject const *Owner, double const mul ) { - std::string submodelname, gaugetypename; - float scale, endscale, endvalue, offset, friction; + std::string submodelname; + std::string gaugetypename; + float scale; + float endscale; + float endvalue; + float offset; + float friction; endscale = -1; endvalue = -1; bool interpolatescale { false }; @@ -144,7 +149,7 @@ void TGauge::Load( cParser &Parser, TDynamicObject const *Owner, double const mu { scratch_data scratchpad; while( true == Load_mapping( Parser, scratchpad ) ) { - ; // all work done by while() + // all work done by while() } // post-deserialization cleanup // set provided custom soundproofing to assigned sounds (for sounds without their own custom soundproofing) diff --git a/vehicle/Gauge.h b/vehicle/Gauge.h index bf0f83c3..3942fc45 100644 --- a/vehicle/Gauge.h +++ b/vehicle/Gauge.h @@ -67,8 +67,8 @@ public: bool is_delayed() const { return ( static_cast( type() ) & static_cast( TGaugeType::delayed ) ) != 0; } // members - TSubModel *SubModel { nullptr }, // McZapkie-310302: zeby mozna bylo sprawdzac czy zainicjowany poprawnie - *SubModelOn { nullptr }; // optional submodel visible when the state input is set + TSubModel *SubModel { nullptr }; // McZapkie-310302: zeby mozna bylo sprawdzac czy zainicjowany poprawnie + TSubModel *SubModelOn { nullptr }; // optional submodel visible when the state input is set private: // types diff --git a/vehicle/Train.cpp b/vehicle/Train.cpp index a77c5749..859f61df 100644 --- a/vehicle/Train.cpp +++ b/vehicle/Train.cpp @@ -87,7 +87,7 @@ void TTrain::screen_entry::deserialize(cParser &Input) while (true == deserialize_mapping(Input)) { - ; // all work done by while() + // all work done by while() } } @@ -1703,12 +1703,10 @@ void TTrain::OnCommand_secondcontrollerset(TTrain *Train, command_data const &Co while (targetposition < Train->mvControlled->GetVirtualScndPos() && true == Train->mvControlled->DecScndCtrl(1)) { // all work is done in the header - ; } while (targetposition > Train->mvControlled->GetVirtualScndPos() && true == Train->mvControlled->IncScndCtrl(1)) { // all work is done in the header - ; } } } @@ -2363,7 +2361,7 @@ void TTrain::OnCommand_epbrakecontrolenable(TTrain *Train, command_data const &C Train->dsbPneumaticSwitch->play(); } Train->ggEPFuseButton.UpdateValue(1.0f, Train->dsbSwitch); - }; + } } } } @@ -2379,7 +2377,7 @@ void TTrain::OnCommand_epbrakecontroldisable(TTrain *Train, command_data const & if (Train->mvOccupied->EpFuseSwitch(false)) { Train->ggEPFuseButton.UpdateValue(0.0f, Train->dsbSwitch); - }; + } } } } @@ -2410,7 +2408,7 @@ void TTrain::OnCommand_epbrakecontroltoggle(TTrain *Train, command_data const &C { Train->dsbPneumaticSwitch->play(); } - }; + } } else { @@ -2428,7 +2426,7 @@ void TTrain::OnCommand_epbrakecontroltoggle(TTrain *Train, command_data const &C { Train->dsbPneumaticSwitch->play(); } - }; + } } // visual feedback Train->ggEPFuseButton.UpdateValue(ispush ? 1.0f : // push or pushtoggle @@ -2705,7 +2703,6 @@ void TTrain::OnCommand_reverserdecrease(TTrain *Train, command_data const &Comma { Train->DynamicObject->Mechanik->DirectionChange(); - ; } } } @@ -12147,7 +12144,8 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con else if (Label == "eimscreen:") { // amperomierz calkowitego pradu - int i, j; + int i; + int j; Parser.getTokens(2, false); Parser >> i >> j; auto &gauge = Cabine[Cabindex].Gauge(-1); // pierwsza wolna gałka @@ -12157,7 +12155,8 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con else if (Label == "brakes:") { // specified pipe pressure of specified consist vehicle - int i, j; + int i; + int j; Parser.getTokens(2, false); Parser >> i >> j; auto &gauge = Cabine[Cabindex].Gauge(-1); // pierwsza wolna gałka diff --git a/vehicle/Train.h b/vehicle/Train.h index 7627bbf8..87641954 100644 --- a/vehicle/Train.h +++ b/vehicle/Train.h @@ -817,31 +817,31 @@ public: // reszta może by?publiczna TButton btHaslerBrakes; // ciśnienie w cylindrach TButton btHaslerCurrent; // prąd na silnikach - std::optional - dsbNastawnikJazdy, - dsbNastawnikBocz, - dsbReverserKey, - dsbBuzzer, dsbBuzzerShp, - m_radiostop, - dsbSlipAlarm, - m_distancecounterclear, - dsbHasler, - dsbSwitch, - dsbPneumaticSwitch, - rsHiss, - rsHissU, - rsHissE, - rsHissX, - rsHissT, - rsSBHiss, - rsSBHissU, - rsBrake, - rsFadeSound, - rsRunningNoise, - rsResonanceNoise, - rsWindSound, - rsHuntingNoise, - m_rainsound; + std::optional dsbNastawnikJazdy; + std::optional dsbNastawnikBocz; + std::optional dsbReverserKey; + std::optional dsbBuzzer; + std::optional dsbBuzzerShp; + std::optional m_radiostop; + std::optional dsbSlipAlarm; + std::optional m_distancecounterclear; + std::optional dsbHasler; + std::optional dsbSwitch; + std::optional dsbPneumaticSwitch; + std::optional rsHiss; + std::optional rsHissU; + std::optional rsHissE; + std::optional rsHissX; + std::optional rsHissT; + std::optional rsSBHiss; + std::optional rsSBHissU; + std::optional rsBrake; + std::optional rsFadeSound; + std::optional rsRunningNoise; + std::optional rsResonanceNoise; + std::optional rsWindSound; + std::optional rsHuntingNoise; + std::optional m_rainsound; sound_source m_radiosound { sound_placement::internal, 2 * EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // cached template for radio messages std::vector>> m_radiomessages; // list of currently played radio messages std::vector>, glm::vec3>> CabSoundLocations; // list of offsets for manually located sounds; @@ -879,7 +879,9 @@ private: float fHVoltage{ 0.0f }; // napi?cie dla dynamicznych ga?ek float fHCurrent[ 4 ] = { 0.0f, 0.0f, 0.0f, 0.0f }; // pr?dy: suma i amperomierze 1,2,3 float fEngine[ 4 ] = { 0.0f, 0.0f, 0.0f, 0.0f }; // obroty te? trzeba pobra? - int iCarNo, iPowerNo, iUnitNo; // liczba pojazdow, czlonow napednych i jednostek spiętych ze sobą + int iCarNo; + int iPowerNo; + int iUnitNo; // liczba pojazdow, czlonow napednych i jednostek spiętych ze sobą bool bDoors[20][5]; // drzwi dla wszystkich czlonow; left+right, left, right, step_left, step_right int iUnits[20]; // numer jednostki int iDoorNo[20]; // liczba drzwi @@ -896,7 +898,8 @@ private: std::vector> bCompressors; bool bHeat[8]; // grzanie // McZapkie: do syczenia - float fPPress, fNPress; + float fPPress; + float fNPress; bool m_mastercontrollerinuse { false }; float m_mastercontrollerreturndelay { 0.f }; screenentry_sequence m_screens; diff --git a/world/Segment.cpp b/world/Segment.cpp index c963922a..ed63eef1 100644 --- a/world/Segment.cpp +++ b/world/Segment.cpp @@ -263,7 +263,8 @@ double TSegment::ComputeLength() const // McZapkie-150503: dlugosc miedzy punkta // Ra: koniec rekurencji jeśli po podziale suma długości nie różni się więcej niż 0.5mm od // poprzedniej // Ra: ewentualnie rozpoznać łuk okręgu płaskiego i liczyć ze wzoru na długość łuku - double t, l = 0; + double t; + double l = 0; glm::dvec3 last{0, 0, 0}; // długość liczona po przesunięciu odcinka do początku układu glm::dvec3 tmp = Point2 - Point1; int m = 20.0 * glm::length(tmp); // było zawsze do 10000, teraz jest liczone odcinkami po około 5cm @@ -404,13 +405,28 @@ bool TSegment::RenderLoft( gfx::vertex_array &Output, glm::dvec3 const &Origin, if( fTsBuffer.empty() ) return false; // prowizoryczne zabezpieczenie przed wysypem - ustalić faktyczną przyczynę - glm::vec3 pos1, pos2, dir, parallel1, parallel2, pt, norm; - float s, step, fOffset, tv1, tv2, t, fEnd; + glm::vec3 pos1; + glm::vec3 pos2; + glm::vec3 dir; + glm::vec3 parallel1; + glm::vec3 parallel2; + glm::vec3 pt; + glm::vec3 norm; + float s; + float step; + float fOffset; + float tv1; + float tv2; + float t; + float fEnd; auto const iNumShapePoints = Transition ? ShapePoints.size() / 2 : ShapePoints.size(); float const texturelength = fTextureLength * Texturescale; float const texturescale = Texturescale; - float m1, jmm1, m2, jmm2; // pozycje względne na odcinku 0...1 (ale nie parametr Beziera) + float m1; + float jmm1; + float m2; + float jmm2; // pozycje względne na odcinku 0...1 (ale nie parametr Beziera) step = fStep; tv1 = 1.0; // Ra: to by można było wyliczać dla odcinka, wyglądało by lepiej s = fStep * iSkip; // iSkip - ile odcinków z początku pominąć diff --git a/world/Segment.h b/world/Segment.h index 645e5663..184784ea 100644 --- a/world/Segment.h +++ b/world/Segment.h @@ -41,10 +41,12 @@ struct segment_data { class TSegment { // aproksymacja toru (zwrotnica ma dwa takie, jeden z nich jest aktywny) private: - glm::dvec3 Point1, CPointOut, CPointIn, Point2; - float - fRoll1 { 0.f }, - fRoll2 { 0.f }; // przechyłka na końcach + glm::dvec3 Point1; + glm::dvec3 CPointOut; + glm::dvec3 CPointIn; + glm::dvec3 Point2; + float fRoll1 { 0.f }; + float fRoll2 { 0.f }; // przechyłka na końcach double fLength { -1.0 }; // długość policzona std::vector fTsBuffer; // wartości parametru krzywej t dla równych odcinków s std::vector fTsSlope; // nachylenie dt/du (= dt/ds * fStep) w tych samych punktach @@ -52,7 +54,9 @@ class TSegment int iSegCount = 0; // ilość odcinków do rysowania krzywej double fDirection = 0.0; // Ra: kąt prostego w planie; dla łuku kąt od Point1 double fStoop = 0.0; // Ra: kąt wzniesienia; dla łuku od Point1 - glm::dvec3 vA, vB, vC; // współczynniki wielomianów trzeciego stopnia vD==Point1 + glm::dvec3 vA; + glm::dvec3 vB; + glm::dvec3 vC; // współczynniki wielomianów trzeciego stopnia vD==Point1 TTrack *pOwner = nullptr; // wskaźnik na właściciela glm::dvec3 GetFirstDerivative(double const fTime) const; diff --git a/world/Traction.cpp b/world/Traction.cpp index ef0c85bd..ca676229 100644 --- a/world/Traction.cpp +++ b/world/Traction.cpp @@ -175,7 +175,8 @@ TTraction::create_geometry( gfx::geometrybank_handle const &Bank ) { if( Wires == 2 ) WireOffset = 0; // jezdny - gfx::basic_vertex startvertex, endvertex; + gfx::basic_vertex startvertex; + gfx::basic_vertex endvertex; startvertex.position = glm::vec3( pPoint1.x - ( pPoint2.z / ddp - pPoint1.z / ddp ) * WireOffset - m_origin.x, @@ -189,7 +190,12 @@ TTraction::create_geometry( gfx::geometrybank_handle const &Bank ) { vertices.emplace_back( startvertex ); vertices.emplace_back( endvertex ); // Nie wiem co 'Marcin - glm::dvec3 pt1, pt2, pt3, pt4, v1, v2; + glm::dvec3 pt1; + glm::dvec3 pt2; + glm::dvec3 pt3; + glm::dvec3 pt4; + glm::dvec3 v1; + glm::dvec3 v2; v1 = pPoint4 - pPoint3; v2 = pPoint2 - pPoint1; float step = 0; @@ -410,7 +416,8 @@ void TTraction::ResistanceCalc(int d, double r, TTractionPowerSource *ps) { //(this) jest przęsłem zasilanym, o rezystancji (r), policzyć rezystancję zastępczą sąsiednich if (d >= 0) { // podążanie we wskazanym kierunku - TTraction *t = hvNext[d], *p; + TTraction *t = hvNext[d]; + TTraction *p; if (ps) psPower[d ^ 1] = ps; // podłączenie podanego else @@ -485,8 +492,12 @@ double TTraction::VoltageGet(double u, double i) return 0.0; } - double r0t, r1t, r0g, r1g; - double i0, i1; + double r0t; + double r1t; + double r0g; + double r1g; + double i0; + double i1; r0t = fResistance[0]; //średni pomysł, ale lepsze niż nic r1t = fResistance[1]; // bo nie uwzględnia spadków z innych pojazdów if (psPower[0] && psPower[1]) diff --git a/world/Traction.h b/world/Traction.h index 6fab29df..e5bfec13 100644 --- a/world/Traction.h +++ b/world/Traction.h @@ -30,7 +30,10 @@ class TTraction : public scene::basic_node int iNext[ 2 ] { 0, 0 }; // do którego końca się łączy int iLast { 0 }; //że niby ostatni drut // ustawiony bit 0, jeśli jest ostatnim drutem w sekcji; bit1 - przedostatni public: - glm::dvec3 pPoint1, pPoint2, pPoint3, pPoint4; + glm::dvec3 pPoint1; + glm::dvec3 pPoint2; + glm::dvec3 pPoint3; + glm::dvec3 pPoint4; glm::dvec3 vParametric; // współczynniki równania parametrycznego odcinka double fHeightDifference { 0.0 }; int iNumSections { 0 };