diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index 13be3c19..ad95da25 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -989,11 +989,11 @@ struct TTransducer struct TPowerParameters { /// Maximum source voltage [V]. - double MaxVoltage; + double MaxVoltage{0.0}; /// Maximum source current [A]. - double MaxCurrent; + double MaxCurrent{0.0}; /// Internal resistance [Ω]. - double IntR; + double IntR{0.001}; /// Type of source (selects which union member is meaningful). TPowerSource SourceType; union @@ -1028,10 +1028,7 @@ struct TPowerParameters }; }; inline TPowerParameters() - { - MaxVoltage = 0.0; - MaxCurrent = 0.0; - IntR = 0.001; + { SourceType = TPowerSource::NotDefined; PowerType = TPowerType::NoPower; RPowerCable.PowerTrans = TPowerType::NoPower; @@ -1090,23 +1087,13 @@ using TMPTRelayTable = TMPTRelay[MotorParametersArraySize + 1]; // indexed like struct TMotorParameters { - double mfi; - double mIsat; - double mfi0; // aproksymacja M(I) silnika} {dla dizla mIsat=przekladnia biegu - double fi; - double Isat; - double fi0; // aproksymacja E(n)=fi*n} {dla dizla fi, mfi: predkosci przelozenia biegu <-> - bool AutoSwitch; - TMotorParameters() - { - mfi = 0.0; - mIsat = 0.0; - mfi0 = 0.0; - fi = 0.0; - Isat = 0.0; - fi0 = 0.0; - AutoSwitch = false; - } + double mfi{0.0}; + double mIsat{0.0}; + double mfi0{0.0}; // aproksymacja M(I) silnika} {dla dizla mIsat=przekladnia biegu + double fi{0.0}; + double Isat{0.0}; + double fi0{0.0}; // aproksymacja E(n)=fi*n} {dla dizla fi, mfi: predkosci przelozenia biegu <-> + bool AutoSwitch{false}; }; struct TUniversalCtrl diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index 5cca8c72..259e23d5 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -463,8 +463,7 @@ double TMoverParameters::Current(double n, double U) TMoverParameters::TMoverParameters(double VelInitial, std::string TypeNameInit, std::string NameInit, int Cab) : TypeName(TypeNameInit), Name(NameInit), CabOccupied(Cab) { WriteLog("------------------------------------------------------"); - WriteLog("init default physic values for " + NameInit + ", [" + TypeNameInit + "]"); - Dim = TDimension(); + WriteLog("init default physic values for " + NameInit + ", [" + TypeNameInit + "]"); // BrakeLevelSet(-2); //Pascal ustawia na 0, przestawimy na odcięcie (CHK jest jeszcze nie wczytane!) iLights[0] = 0; diff --git a/McZapkie/Oerlikon_ESt.h b/McZapkie/Oerlikon_ESt.h index c8f896cc..224ffecd 100644 --- a/McZapkie/Oerlikon_ESt.h +++ b/McZapkie/Oerlikon_ESt.h @@ -91,15 +91,11 @@ class TPrzeciwposlizg : public TRura // przy napelnianiu - rura, przy poslizgu - { private: - bool Poslizg; + bool Poslizg{false}; public: void SetPoslizg(bool flag); - void Update(double dt) override; - inline TPrzeciwposlizg() : TRura() - { - Poslizg = false; - } + void Update(double dt) override; }; // przekladnik dwustopniowy diff --git a/McZapkie/hamulce.cpp b/McZapkie/hamulce.cpp index a3867bfc..2572432a 100644 --- a/McZapkie/hamulce.cpp +++ b/McZapkie/hamulce.cpp @@ -357,21 +357,14 @@ end ; */ /// Friction material id (bp_* constant, optionally OR'ed with bp_MHS). /// Number of braked axles. /// Number of blocks per axle. -TBrake::TBrake(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) +TBrake::TBrake(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : + BCN(i_bcn), BCM(1), BCA(i_bcn * i_bcr * i_bcr * M_PI), BrakeDelays(i_BD), MaxBP(i_mbp), BA(i_ba), NBpA(i_nbpa), SizeBR(i_brc * 0.0128) { // inherited:: Create; - MaxBP = i_mbp; - BCN = i_bcn; - BCM = 1; - BCA = i_bcn * i_bcr * i_bcr * M_PI; - BA = i_ba; - NBpA = i_nbpa; - BrakeDelays = i_BD; BrakeDelayFlag = bdelay_P; // 210.88 // SizeBR:=i_bcn*i_bcr*i_bcr*i_bcd*40.17*MaxBP/(5-MaxBP); //objetosc ZP w stosunku do cylindra - // 14" i cisnienia 4.2 atm - SizeBR = i_brc * 0.0128; + // 14" i cisnienia 4.2 atm SizeBC = i_bcn * i_bcr * i_bcr * i_bcd * 210.88 * MaxBP / 4.2; // objetosc CH w stosunku do cylindra 14" i cisnienia 4.2 atm BrakeCyl = std::make_shared(); diff --git a/gl/shader.cpp b/gl/shader.cpp index 4e357777..1ca66dfe 100644 --- a/gl/shader.cpp +++ b/gl/shader.cpp @@ -303,9 +303,8 @@ void gl::shader::log_error(const std::string &str) const ErrorLog("bad shader: " + name + ": " + str, logtype::shader); } -gl::shader::shader(const std::string &filename) +gl::shader::shader(const std::string &filename) : name(filename) { - name = filename; auto [shadertype, shadersource] = process_source(filename, "shaders/"); diff --git a/gl/ubo.cpp b/gl/ubo.cpp index cecf84f0..ad6f1611 100644 --- a/gl/ubo.cpp +++ b/gl/ubo.cpp @@ -1,10 +1,9 @@ #include "stdafx.h" #include "ubo.h" -gl::ubo::ubo(size_t size, int idx, GLenum hint) +gl::ubo::ubo(size_t size, int idx, GLenum hint) : index(idx) { allocate(buffer::UNIFORM_BUFFER, size, hint); - index = idx; bind_uniform(); } diff --git a/network/network.cpp b/network/network.cpp index 2d467396..5d1680c6 100644 --- a/network/network.cpp +++ b/network/network.cpp @@ -30,9 +30,7 @@ void network::connection::set_handler(std::function hand message_handler = handler; } -network::connection::connection(bool client, size_t counter) { - packet_counter = counter; - is_client = client; +network::connection::connection(bool client, size_t counter) : is_client(client), packet_counter(counter) { state = AWAITING_HELLO; } diff --git a/scripting/pythonscreenviewer.cpp b/scripting/pythonscreenviewer.cpp index 27a0b36f..d4a2843e 100644 --- a/scripting/pythonscreenviewer.cpp +++ b/scripting/pythonscreenviewer.cpp @@ -30,9 +30,8 @@ void texture_window_cursor_pos(GLFWwindow *win, double x, double y) } python_screen_viewer::python_screen_viewer(std::shared_ptr rt, std::shared_ptr> touchlist, std::string surfacename) + : m_rt(rt), m_touchlist(touchlist) { - m_rt = rt; - m_touchlist = touchlist; for (const auto &viewport : Global.python_viewports) { if (viewport.surface == surfacename) { diff --git a/utilities/Float3d.h b/utilities/Float3d.h index 68feea2b..759ff171 100644 --- a/utilities/Float3d.h +++ b/utilities/Float3d.h @@ -19,12 +19,7 @@ class float3 float y; float z; float3() = default; - float3(float a, float b, float c) - { - x = a; - y = b; - z = c; - }; + float3(float a, float b, float c) : x(a), y(b), z(c) {} float Length() const; float LengthSquared() const; @@ -106,20 +101,8 @@ class float4 float y; float z; float w; - float4() - { - x = 0.f; - y = 0.f; - z = 0.f; - w = 1.f; - }; - float4(float a, float b, float c, float d) - { - x = a; - y = b; - z = c; - w = d; - }; + float4() : x(0.f), y(0.f), z(0.f), w(1.f) {} + float4(float a, float b, float c, float d) : x(a), y(b), z(c), w(d) {} float inline LengthSquared() const { return x * x + y * y + z * z + w * w; diff --git a/vehicle/Train.cpp b/vehicle/Train.cpp index c0058b81..d358184c 100644 --- a/vehicle/Train.cpp +++ b/vehicle/Train.cpp @@ -584,22 +584,12 @@ std::vector const TTrain::fPress_labels = { TTrain::TTrain() { + + // McZapkie-240302 - przyda sie do tachometru - ShowNextCurrent = false; - // McZapkie-240302 - przyda sie do tachometru - fTachoVelocity = 0; - fTachoCount = 0; - fPPress = 0; - fNPress = 0; - - // asMessage=""; - pMechOffset = glm::dvec3(0, 0, 0); - fBlinkTimer = 0; - fHaslerTimer = 0; + // asMessage=""; DynamicSet(nullptr); // ustawia wszystkie mv* - //----- - pMechSittingPosition = glm::dvec3(0, 0, 0); // ABu: 180404 - fTachoTimer = 0.0; // włączenie skoków wskazań prędkościomierza + //----- // for (int i = 0; i < 8; i++) diff --git a/vehicle/Train.h b/vehicle/Train.h index 3d762a81..478bb7a2 100644 --- a/vehicle/Train.h +++ b/vehicle/Train.h @@ -146,7 +146,7 @@ class TTrain { // methods bool CabChange(int iDirection); - bool ShowNextCurrent; // pokaz przd w podlaczonej lokomotywie (ET41) + bool ShowNextCurrent{false}; // pokaz przd w podlaczonej lokomotywie (ET41) bool InitializeCab(int NewCabNo, std::string const &asFileName); TTrain(); ~TTrain(); @@ -857,14 +857,14 @@ public: // reszta może by?publiczna int iCabn { 0 }; // 0: mid, 1: front, 2: rear bool is_cab_initialized { false }; // McZapkie: do poruszania sie po kabinie - glm::dvec3 pMechSittingPosition; // ABu 180404 + glm::dvec3 pMechSittingPosition{0.0}; // ABu 180404 glm::dvec3 MirrorPosition(bool lewe); - glm::dvec3 pMechOffset; // base position of the driver in the cab + glm::dvec3 pMechOffset{0.0}; // base position of the driver in the cab glm::vec2 pMechViewAngle { 0.0, 0.0 }; // camera pitch and yaw values, preserved while in external view private: - double fBlinkTimer; - float fHaslerTimer; + double fBlinkTimer{0.0}; + float fHaslerTimer{0.0f}; float fConverterTimer; // hunter-261211: dla przekaznika float fMainRelayTimer; // hunter-141211: zalaczanie WSa z opoznieniem float fBatteryTimer = {-1.f}; // Hirek: zalaczanie baterii z opoznieniem (tylko gdy zdefiniowano takie zachowanie w fiz) @@ -898,8 +898,8 @@ private: std::vector> bCompressors; bool bHeat[8]; // grzanie // McZapkie: do syczenia - float fPPress; - float fNPress; + float fPPress{0.0f}; + float fNPress{0.0f}; bool m_mastercontrollerinuse { false }; float m_mastercontrollerreturndelay { 0.f }; screenentry_sequence m_screens;