mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-18 09:09:19 +02:00
refactor(sonar): initialise members in initialiser lists or declarations (cpp:S3230)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -989,11 +989,11 @@ struct TTransducer
|
||||
struct TPowerParameters
|
||||
{
|
||||
/// <summary>Maximum source voltage [V].</summary>
|
||||
double MaxVoltage;
|
||||
double MaxVoltage{0.0};
|
||||
/// <summary>Maximum source current [A].</summary>
|
||||
double MaxCurrent;
|
||||
double MaxCurrent{0.0};
|
||||
/// <summary>Internal resistance [Ω].</summary>
|
||||
double IntR;
|
||||
double IntR{0.001};
|
||||
/// <summary>Type of source (selects which union member is meaningful).</summary>
|
||||
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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -357,21 +357,14 @@ end ; */
|
||||
/// <param name="i_mat">Friction material id (bp_* constant, optionally OR'ed with bp_MHS).</param>
|
||||
/// <param name="i_ba">Number of braked axles.</param>
|
||||
/// <param name="i_nbpa">Number of blocks per axle.</param>
|
||||
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<TBrakeCyl>();
|
||||
|
||||
@@ -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/");
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,9 +30,7 @@ void network::connection::set_handler(std::function<void (const message &)> 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,9 +30,8 @@ void texture_window_cursor_pos(GLFWwindow *win, double x, double y)
|
||||
}
|
||||
|
||||
python_screen_viewer::python_screen_viewer(std::shared_ptr<python_rt> rt, std::shared_ptr<std::vector<glm::vec2>> 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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -584,22 +584,12 @@ std::vector<std::string> 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;
|
||||
|
||||
|
||||
//-----
|
||||
pMechSittingPosition = glm::dvec3(0, 0, 0); // ABu: 180404
|
||||
fTachoTimer = 0.0; // włączenie skoków wskazań prędkościomierza
|
||||
|
||||
// asMessage="";
|
||||
|
||||
|
||||
|
||||
@@ -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<std::tuple<bool, bool, int>> 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;
|
||||
|
||||
Reference in New Issue
Block a user