17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 05:09:20 +02:00

refactor(sonar): declare variables separately from their type definitions (cpp:S3646)

This commit is contained in:
jerrrrycho
2026-10-10 16:33:12 +02:00
parent 3c80ea20c7
commit afbd49cc66
5 changed files with 19 additions and 9 deletions

View File

@@ -1465,7 +1465,8 @@ class TMoverParameters
{ {
float temp_min{-1}; // lowest accepted temperature float temp_min{-1}; // lowest accepted temperature
float temp_max{-1}; // highest accepted temperature float temp_max{-1}; // highest accepted temperature
} config; };
heater_config_t config;
// ld inputs // ld inputs
bool breaker{false}; // device is allowed to operate bool breaker{false}; // device is allowed to operate
bool is_enabled{false}; // device is requested to operate bool is_enabled{false}; // device is requested to operate
@@ -1500,12 +1501,17 @@ class TMoverParameters
float temp_cooling{-1}; // active cooling activation point float temp_cooling{-1}; // active cooling activation point
float temp_flow{-1}; // fluid flow activation point float temp_flow{-1}; // fluid flow activation point
bool shutters{false}; // the radiator has shutters to assist the cooling bool shutters{false}; // the radiator has shutters to assist the cooling
} config; };
circuit_config_t config;
bool is_cold{false}; // fluid is too cold bool is_cold{false}; // fluid is too cold
bool is_warm{false}; // fluid is too hot bool is_warm{false}; // fluid is too hot
bool is_hot{false}; // fluid temperature crossed cooling threshold bool is_hot{false}; // fluid temperature crossed cooling threshold
bool is_flowing{false}; // fluid is being pushed through the circuit bool is_flowing{false}; // fluid is being pushed through the circuit
} water, water_aux, oil, engine; };
fluid_circuit_t water;
fluid_circuit_t water_aux;
fluid_circuit_t oil;
fluid_circuit_t engine;
// output, state of affected devices // output, state of affected devices
bool PA{false}; // malfunction flag bool PA{false}; // malfunction flag
float rpmw{0.0}; // current main circuit fan revolutions float rpmw{0.0}; // current main circuit fan revolutions

View File

@@ -19,7 +19,7 @@ struct IMaterial
virtual texture_handle GetTexture(int slot) const = 0; virtual texture_handle GetTexture(int slot) const = 0;
static IMaterial *null_material() static IMaterial *null_material()
{ {
static struct NullMaterial : public IMaterial struct NullMaterial : public IMaterial
{ {
void finalize(bool Loadnow) override { /* null implementation, nothing to do */ } void finalize(bool Loadnow) override { /* null implementation, nothing to do */ }
bool update() override bool update() override
@@ -54,7 +54,8 @@ struct IMaterial
{ {
return 0; return 0;
} }
} null_material{}; };
static NullMaterial null_material{};
return &null_material; return &null_material;
} }
virtual ~IMaterial() = default; virtual ~IMaterial() = default;

View File

@@ -23,7 +23,7 @@ struct ITexture
virtual void update_from_memory(size_t width, size_t height, const uint8_t *data) = 0; virtual void update_from_memory(size_t width, size_t height, const uint8_t *data) = 0;
static ITexture *null_texture() static ITexture *null_texture()
{ {
static struct NullTexture : public ITexture struct NullTexture : public ITexture
{ {
bool create(bool Static = false) override bool create(bool Static = false) override
{ {
@@ -70,7 +70,8 @@ struct ITexture
void set_components_hint(int hint) override { /* null implementation, nothing to do */ } void set_components_hint(int hint) override { /* null implementation, nothing to do */ }
void make_from_memory(size_t width, size_t height, const uint8_t *data) override { /* null implementation, nothing to do */ } void make_from_memory(size_t width, size_t height, const uint8_t *data) override { /* null implementation, nothing to do */ }
void update_from_memory(size_t width, size_t height, const uint8_t *data) override { /* null implementation, nothing to do */ } void update_from_memory(size_t width, size_t height, const uint8_t *data) override { /* null implementation, nothing to do */ }
} null_texture{}; };
static NullTexture null_texture{};
return &null_texture; return &null_texture;
} }
virtual ~ITexture() = default; virtual ~ITexture() = default;

View File

@@ -67,7 +67,8 @@ scenario_time::init(std::time_t timestamp) {
long DaylightBias; long DaylightBias;
SYSTEMTIME StandardDate; SYSTEMTIME StandardDate;
SYSTEMTIME DaylightDate; SYSTEMTIME DaylightDate;
} timezoneinfo = { -60, 0, -60, { 0, 10, 0, 5, 3, 0, 0, 0 }, { 0, 3, 0, 5, 2, 0, 0, 0 } }; };
registry_time_zone_info timezoneinfo = { -60, 0, -60, { 0, 10, 0, 5, 3, 0, 0, 0 }, { 0, 3, 0, 5, 2, 0, 0, 0 } };
convert_transition_time( timezoneinfo.StandardDate ); convert_transition_time( timezoneinfo.StandardDate );
convert_transition_time( timezoneinfo.DaylightDate ); convert_transition_time( timezoneinfo.DaylightDate );

View File

@@ -45,7 +45,8 @@ struct launcher : public map_object
enum type_e { enum type_e {
track_switch, track_switch,
level_crossing level_crossing
} type; };
type_e type;
gfx::basic_vertex vertex() override { gfx::basic_vertex vertex() override {
return gfx::basic_vertex(location, glm::vec3(), return gfx::basic_vertex(location, glm::vec3(),