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

refactor(sonar): prefer using over typedef (cpp:S5416)

This commit is contained in:
jerrrrycho
2026-10-10 15:05:42 +02:00
parent 6b0617cc97
commit 3f1c9720fb
10 changed files with 23 additions and 23 deletions

View File

@@ -764,7 +764,7 @@ enum class TLocalBrake
HydraulicBrake
};
/// <summary>Brake delay parameter table (apply/release for passenger and freight).</summary>
typedef double TBrakeDelayTable[4];
using TBrakeDelayTable = double[4];
/// <summary>One row of the brake pressure / pipe pressure / flow-speed table for a brake handle position.</summary>
struct TBrakePressure
@@ -780,7 +780,7 @@ struct TBrakePressure
};
/// <summary>Brake pressure table indexed by handle position.</summary>
typedef std::map<int, TBrakePressure> TBrakePressureTable;
using TBrakePressureTable = std::map<int, TBrakePressure>;
/// <summary>Engine / drive type.</summary>
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[MotorParametersArraySize + 1]; // indexed like MotorParam
using TMPTRelayTable = TMPTRelay[MotorParametersArraySize + 1]; // indexed like MotorParam
struct TMotorParameters
{

View File

@@ -275,7 +275,7 @@ class TReservoir
};
/// <summary>Pointer typedef for a reservoir instance.</summary>
typedef TReservoir *PReservoir;
using PReservoir = TReservoir *;
/// <summary>
/// Brake cylinder reservoir — overrides pressure functions to model the

View File

@@ -1,6 +1,6 @@
#pragma once
typedef int texture_handle;
using texture_handle = int;
#define null_handle (0)

View File

@@ -455,8 +455,8 @@ class command_queue {
public:
// types
typedef std::deque<command_data> commanddata_sequence;
typedef std::unordered_map<uint32_t, commanddata_sequence> commands_map;
using commanddata_sequence = std::deque<command_data>;
using commands_map = std::unordered_map<uint32_t, commanddata_sequence>;
// methods
// posts specified command for specified recipient into m_intercept_queue
void
@@ -511,7 +511,7 @@ void add_to_dequemap(std::unordered_map<A, std::deque<B>> &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<command_description> commanddescription_sequence;
using commanddescription_sequence = std::vector<command_description>;
extern command_queue Commands;
// TODO: add name to command map, and wrap these two into helper object

View File

@@ -84,7 +84,7 @@ private:
user_command down;
};
typedef std::unordered_map<std::string, button_bindings> buttonbindings_map;
using buttonbindings_map = std::unordered_map<std::string, button_bindings>;
// methods
void

View File

@@ -26,8 +26,8 @@ public:
private:
// types:
typedef std::deque<TMdlContainer> modelcontainer_sequence;
typedef std::unordered_map<std::string, modelcontainer_sequence::size_type> stringmodelcontainerindex_map;
using modelcontainer_sequence = std::deque<TMdlContainer>;
using stringmodelcontainerindex_map = std::unordered_map<std::string, modelcontainer_sequence::size_type>;
// members:
static modelcontainer_sequence m_models;
static stringmodelcontainerindex_map m_modelsmap;

View File

@@ -36,7 +36,7 @@ public:
update();
// types
typedef std::vector<light_record> lightrecord_array;
using lightrecord_array = std::vector<light_record>;
// members
lightrecord_array data;

View File

@@ -90,7 +90,7 @@ private:
};
enum stack_mode { gl_modelview = 0, gl_projection = 1, gl_texture = 2 };
typedef std::vector<opengl_stack> openglstack_array;
using openglstack_array = std::vector<opengl_stack>;
public:
// constructors:

View File

@@ -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<std::string>;
stringset m_names; // names of registered controls
@@ -142,7 +142,7 @@ class TTrain {
bool deserialize_mapping( cParser &Input );
};
typedef std::vector<screen_entry> screenentry_sequence;
using screenentry_sequence = std::vector<screen_entry>;
// 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<user_command, command_handler> commandhandler_map;
using command_handler = void (*)( TTrain *Train, command_data const &Command );
using commandhandler_map = std::unordered_map<user_command, command_handler>;
// methods
// clears state of all cabin controls
void clear_cab_controls();

View File

@@ -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;