mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-06 00:02:26 +01:00
refactor(sonar): take read-only pointer and reference parameters as const (cpp:S995)
TTrain command handlers keep their signature, it is fixed by the handler table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2311,7 +2311,7 @@ class TMoverParameters
|
|||||||
bool CurrentSwitch(bool const State);
|
bool CurrentSwitch(bool const State);
|
||||||
bool IsMotorOverloadRelayHighThresholdOn() const;
|
bool IsMotorOverloadRelayHighThresholdOn() const;
|
||||||
void UpdateBatteryVoltage(double dt);
|
void UpdateBatteryVoltage(double dt);
|
||||||
double ComputeMovement(double dt, double dt1, const TTrackShape &Shape, TTrackParam &Track, TTractionParam &ElectricTraction, TLocation const &NewLoc,
|
double ComputeMovement(double dt, double dt1, const TTrackShape &Shape, TTrackParam const &Track, TTractionParam const &ElectricTraction, TLocation const &NewLoc,
|
||||||
TRotation const &NewRot); // oblicza przesuniecie pojazdu
|
TRotation const &NewRot); // oblicza przesuniecie pojazdu
|
||||||
double FastComputeMovement(double dt, const TTrackShape &Shape, TTrackParam &Track, TLocation const &NewLoc, TRotation const &NewRot); // oblicza przesuniecie pojazdu - wersja zoptymalizowana
|
double FastComputeMovement(double dt, const TTrackShape &Shape, TTrackParam &Track, TLocation const &NewLoc, TRotation const &NewRot); // oblicza przesuniecie pojazdu - wersja zoptymalizowana
|
||||||
void compute_movement_(double const Deltatime);
|
void compute_movement_(double const Deltatime);
|
||||||
|
|||||||
@@ -1352,7 +1352,7 @@ void TMoverParameters::Derail(DerailReason const Reason)
|
|||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
// Oblicza przemieszczenie taboru
|
// Oblicza przemieszczenie taboru
|
||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShape &Shape, TTrackParam &Track, TTractionParam &ElectricTraction, TLocation const &NewLoc, TRotation const &NewRot)
|
double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShape &Shape, TTrackParam const &Track, TTractionParam const &ElectricTraction, TLocation const &NewLoc, TRotation const &NewRot)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!TestFlag(DamageFlag, dtrain_out))
|
if (!TestFlag(DamageFlag, dtrain_out))
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ float CSkyDome::GetZenith( float Zenithmatrix[ 3 ][ 4 ], const float Theta, cons
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float CSkyDome::PerezFunctionO1( float Perezcoeffs[ 5 ], const float Thetasun, const float Zenithval ) const {
|
float CSkyDome::PerezFunctionO1( float const Perezcoeffs[ 5 ], const float Thetasun, const float Zenithval ) const {
|
||||||
|
|
||||||
const float val = static_cast<float>(( 1.0f + Perezcoeffs[ 0 ] * std::exp( Perezcoeffs[ 1 ] ) ) *
|
const float val = static_cast<float>(( 1.0f + Perezcoeffs[ 0 ] * std::exp( Perezcoeffs[ 1 ] ) ) *
|
||||||
( 1.0f + Perezcoeffs[ 2 ] * std::exp( Perezcoeffs[ 3 ] * Thetasun ) + Perezcoeffs[ 4 ] * std::pow( std::cos( Thetasun ), 2 ) ));
|
( 1.0f + Perezcoeffs[ 2 ] * std::exp( Perezcoeffs[ 3 ] * Thetasun ) + Perezcoeffs[ 4 ] * std::pow( std::cos( Thetasun ), 2 ) ));
|
||||||
@@ -174,7 +174,7 @@ float CSkyDome::PerezFunctionO1( float Perezcoeffs[ 5 ], const float Thetasun, c
|
|||||||
return Zenithval / val;
|
return Zenithval / val;
|
||||||
}
|
}
|
||||||
|
|
||||||
float CSkyDome::PerezFunctionO2( float Perezcoeffs[ 5 ], const float Icostheta, const float Gamma, const float Cosgamma2, const float Zenithval ) const {
|
float CSkyDome::PerezFunctionO2( float const Perezcoeffs[ 5 ], const float Icostheta, const float Gamma, const float Cosgamma2, const float Zenithval ) const {
|
||||||
// iCosTheta = 1.0f / cosf(theta)
|
// iCosTheta = 1.0f / cosf(theta)
|
||||||
// cosGamma2 = SQR( cosf( gamma ) )
|
// cosGamma2 = SQR( cosf( gamma ) )
|
||||||
return Zenithval * ( 1.0f + Perezcoeffs[ 0 ] * std::exp( Perezcoeffs[ 1 ] * Icostheta ) ) *
|
return Zenithval * ( 1.0f + Perezcoeffs[ 0 ] * std::exp( Perezcoeffs[ 1 ] * Icostheta ) ) *
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ private:
|
|||||||
// coloring
|
// coloring
|
||||||
void GetPerez( float *Perez, float Distribution[ 5 ][ 2 ], const float Turbidity ) const;
|
void GetPerez( float *Perez, float Distribution[ 5 ][ 2 ], const float Turbidity ) const;
|
||||||
float GetZenith( float Zenithmatrix[ 3 ][ 4 ], const float Theta, const float Turbidity ) const;
|
float GetZenith( float Zenithmatrix[ 3 ][ 4 ], const float Theta, const float Turbidity ) const;
|
||||||
float PerezFunctionO1( float Perezcoeffs[ 5 ], const float Thetasun, const float Zenithval ) const;
|
float PerezFunctionO1( float const Perezcoeffs[ 5 ], const float Thetasun, const float Zenithval ) const;
|
||||||
float PerezFunctionO2( float Perezcoeffs[ 5 ], const float Icostheta, const float Gamma, const float Cosgamma2, const float Zenithval ) const;
|
float PerezFunctionO2( float const Perezcoeffs[ 5 ], const float Icostheta, const float Gamma, const float Cosgamma2, const float Zenithval ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ size_t piped_proc::read(unsigned char *buf, size_t len)
|
|||||||
return fread(buf, 1, len, file);
|
return fread(buf, 1, len, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t piped_proc::write(unsigned char *buf, size_t len)
|
size_t piped_proc::write(unsigned char const *buf, size_t len)
|
||||||
{
|
{
|
||||||
if (!file)
|
if (!file)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -97,7 +97,7 @@ size_t piped_proc::read(unsigned char *buf, size_t len)
|
|||||||
return read;
|
return read;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t piped_proc::write(unsigned char *buf, size_t len)
|
size_t piped_proc::write(unsigned char const *buf, size_t len)
|
||||||
{
|
{
|
||||||
if (!pipe_wr)
|
if (!pipe_wr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -25,6 +25,6 @@ HANDLE pipe_wr = nullptr;
|
|||||||
public:
|
public:
|
||||||
explicit piped_proc(std::string cmd, bool write = false);
|
explicit piped_proc(std::string cmd, bool write = false);
|
||||||
size_t read(unsigned char *buf, size_t len);
|
size_t read(unsigned char *buf, size_t len);
|
||||||
size_t write(unsigned char *buf, size_t len);
|
size_t write(unsigned char const *buf, size_t len);
|
||||||
~piped_proc();
|
~piped_proc();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ void gl::framebuffer::blit_from(framebuffer *other, int w, int h, GLbitfield mas
|
|||||||
blit(other, this, 0, 0, w, h, mask, attachment);
|
blit(other, this, 0, 0, w, h, mask, attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gl::framebuffer::blit(framebuffer *src, framebuffer *dst, int sx, int sy, int w, int h, GLbitfield mask, GLenum attachment)
|
void gl::framebuffer::blit(framebuffer const *src, framebuffer const *dst, int sx, int sy, int w, int h, GLbitfield mask, GLenum attachment)
|
||||||
{
|
{
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, src ? *src : 0);
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, src ? *src : 0);
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, dst ? *dst : 0);
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, dst ? *dst : 0);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace gl
|
|||||||
void blit_to(framebuffer *other, int w, int h, GLbitfield mask, GLenum attachment);
|
void blit_to(framebuffer *other, int w, int h, GLbitfield mask, GLenum attachment);
|
||||||
void blit_from(framebuffer *other, int w, int h, GLbitfield mask, GLenum attachment);
|
void blit_from(framebuffer *other, int w, int h, GLbitfield mask, GLenum attachment);
|
||||||
|
|
||||||
static void blit(framebuffer *src, framebuffer *dst, int sx, int sy, int w, int h, GLbitfield mask, GLenum attachment);
|
static void blit(framebuffer const *src, framebuffer const *dst, int sx, int sy, int w, int h, GLbitfield mask, GLenum attachment);
|
||||||
|
|
||||||
using bindable::bind;
|
using bindable::bind;
|
||||||
static void bind(GLuint id);
|
static void bind(GLuint id);
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ drivermouse_input::button( int const Button, int const Action ) {
|
|||||||
// left mouse button launches on_click event associated with to the node
|
// left mouse button launches on_click event associated with to the node
|
||||||
if (Button == GLFW_MOUSE_BUTTON_LEFT && Action == GLFW_PRESS) {
|
if (Button == GLFW_MOUSE_BUTTON_LEFT && Action == GLFW_PRESS) {
|
||||||
GfxRenderer->Pick_Node_Callback(
|
GfxRenderer->Pick_Node_Callback(
|
||||||
[](scene::basic_node *node) {
|
[](scene::basic_node const *node) {
|
||||||
if( node == nullptr
|
if( node == nullptr
|
||||||
|| typeid(*node) != typeid(TAnimModel) )
|
|| typeid(*node) != typeid(TAnimModel) )
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ gamepad_input::poll() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gamepad_input::bind( std::vector< std::reference_wrapper<user_command> > &Targets, cParser &Input, std::unordered_map<std::string, user_command> const &Translator, std::string const Point ) const {
|
gamepad_input::bind( std::vector< std::reference_wrapper<user_command> > const &Targets, cParser &Input, std::unordered_map<std::string, user_command> const &Translator, std::string const Point ) const {
|
||||||
|
|
||||||
for( auto const &bindingtarget : Targets ) {
|
for( auto const &bindingtarget : Targets ) {
|
||||||
// grab command(s) associated with the input pin
|
// grab command(s) associated with the input pin
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ private:
|
|||||||
using inputaxis_sequence = std::vector<input_axis>;
|
using inputaxis_sequence = std::vector<input_axis>;
|
||||||
// methods
|
// methods
|
||||||
bool recall_bindings();
|
bool recall_bindings();
|
||||||
void bind( std::vector< std::reference_wrapper<user_command> > &Targets, cParser &Input, std::unordered_map<std::string, user_command> const &Translator, std::string const Point ) const;
|
void bind( std::vector< std::reference_wrapper<user_command> > const &Targets, cParser &Input, std::unordered_map<std::string, user_command> const &Translator, std::string const Point ) const;
|
||||||
void on_button( int const Button, int const Action );
|
void on_button( int const Button, int const Action );
|
||||||
void process_axes();
|
void process_axes();
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ Navigate([[maybe_unused]] std::string const &ClassName, [[maybe_unused]] UINT Ms
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
OnCommandGet(multiplayer::DaneRozkaz *pRozkaz)
|
OnCommandGet(multiplayer::DaneRozkaz const *pRozkaz)
|
||||||
{ // odebranie komunikatu z serwera
|
{ // odebranie komunikatu z serwera
|
||||||
if (pRozkaz->iSygn == EU07_MESSAGEHEADER )
|
if (pRozkaz->iSygn == EU07_MESSAGEHEADER )
|
||||||
switch (pRozkaz->iComm)
|
switch (pRozkaz->iComm)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ struct DaneRozkaz2 { // struktura komunikacji z EU07.EXE
|
|||||||
|
|
||||||
void Navigate( std::string const &ClassName, UINT Msg, WPARAM wParam, LPARAM lParam );
|
void Navigate( std::string const &ClassName, UINT Msg, WPARAM wParam, LPARAM lParam );
|
||||||
|
|
||||||
void OnCommandGet( multiplayer::DaneRozkaz *pRozkaz );
|
void OnCommandGet( multiplayer::DaneRozkaz const *pRozkaz );
|
||||||
|
|
||||||
void WyslijEvent( const std::string &e, const std::string &d );
|
void WyslijEvent( const std::string &e, const std::string &d );
|
||||||
void WyslijString( const std::string &t, int n );
|
void WyslijString( const std::string &t, int n );
|
||||||
|
|||||||
@@ -530,7 +530,7 @@ auto python_taskqueue::fetch_renderer(std::string const Renderer) -> PyObject *
|
|||||||
return renderer;
|
return renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void python_taskqueue::run(GLFWwindow *Context, rendertask_sequence &Tasks, uploadtask_sequence &Upload_Tasks, threading::condition_variable &Condition, std::atomic<bool> &Exit)
|
void python_taskqueue::run(GLFWwindow *Context, rendertask_sequence &Tasks, uploadtask_sequence &Upload_Tasks, threading::condition_variable &Condition, std::atomic<bool> const &Exit)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (Context)
|
if (Context)
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ class python_taskqueue
|
|||||||
using uploadtask_sequence = threading::lockable<std::deque<std::shared_ptr<render_task>>>;
|
using uploadtask_sequence = threading::lockable<std::deque<std::shared_ptr<render_task>>>;
|
||||||
// methods
|
// methods
|
||||||
auto fetch_renderer(std::string const Renderer) -> PyObject *;
|
auto fetch_renderer(std::string const Renderer) -> PyObject *;
|
||||||
void run(GLFWwindow *Context, rendertask_sequence &Tasks, uploadtask_sequence &Upload_Tasks, threading::condition_variable &Condition, std::atomic<bool> &Exit);
|
void run(GLFWwindow *Context, rendertask_sequence &Tasks, uploadtask_sequence &Upload_Tasks, threading::condition_variable &Condition, std::atomic<bool> const &Exit);
|
||||||
void error();
|
void error();
|
||||||
|
|
||||||
// members
|
// members
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ void python_screen_viewer::threadfunc()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void python_screen_viewer::notify_window_fb_size(GLFWwindow *window, int w, int h) const
|
void python_screen_viewer::notify_window_fb_size(GLFWwindow const *window, int w, int h) const
|
||||||
{
|
{
|
||||||
for (auto const &conf : m_windows) {
|
for (auto const &conf : m_windows) {
|
||||||
if (conf->window == window) {
|
if (conf->window == window) {
|
||||||
@@ -199,7 +199,7 @@ void python_screen_viewer::notify_window_fb_size(GLFWwindow *window, int w, int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void python_screen_viewer::notify_window_size(GLFWwindow *window, int w, int h) const
|
void python_screen_viewer::notify_window_size(GLFWwindow const *window, int w, int h) const
|
||||||
{
|
{
|
||||||
for (auto const &conf : m_windows) {
|
for (auto const &conf : m_windows) {
|
||||||
if (conf->window == window) {
|
if (conf->window == window) {
|
||||||
@@ -210,7 +210,7 @@ void python_screen_viewer::notify_window_size(GLFWwindow *window, int w, int h)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void python_screen_viewer::notify_cursor_pos(GLFWwindow *window, double x, double y) const
|
void python_screen_viewer::notify_cursor_pos(GLFWwindow const *window, double x, double y) const
|
||||||
{
|
{
|
||||||
for (auto const &conf : m_windows) {
|
for (auto const &conf : m_windows) {
|
||||||
if (conf->window == window) {
|
if (conf->window == window) {
|
||||||
@@ -221,7 +221,7 @@ void python_screen_viewer::notify_cursor_pos(GLFWwindow *window, double x, doubl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void python_screen_viewer::notify_click(GLFWwindow *window, int button, int action) const
|
void python_screen_viewer::notify_click(GLFWwindow const *window, int button, int action) const
|
||||||
{
|
{
|
||||||
if (button != GLFW_MOUSE_BUTTON_LEFT || action != GLFW_PRESS)
|
if (button != GLFW_MOUSE_BUTTON_LEFT || action != GLFW_PRESS)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ public:
|
|||||||
python_screen_viewer(std::shared_ptr<python_rt> rt, std::shared_ptr<std::vector<glm::vec2>> touchlist, std::string name);
|
python_screen_viewer(std::shared_ptr<python_rt> rt, std::shared_ptr<std::vector<glm::vec2>> touchlist, std::string name);
|
||||||
~python_screen_viewer();
|
~python_screen_viewer();
|
||||||
|
|
||||||
void notify_window_size(GLFWwindow *window, int w, int h) const;
|
void notify_window_size(GLFWwindow const *window, int w, int h) const;
|
||||||
void notify_window_fb_size(GLFWwindow *window, int w, int h) const;
|
void notify_window_fb_size(GLFWwindow const *window, int w, int h) const;
|
||||||
void notify_cursor_pos(GLFWwindow *window, double x, double y) const;
|
void notify_cursor_pos(GLFWwindow const *window, double x, double y) const;
|
||||||
void notify_click(GLFWwindow *window, int button, int action) const;
|
void notify_click(GLFWwindow const *window, int button, int action) const;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ void float4x4::serialize_float32(std::ostream &s) const
|
|||||||
sn_utils::ls_float32(s, element);
|
sn_utils::ls_float32(s, element);
|
||||||
}
|
}
|
||||||
|
|
||||||
void float4x4::Quaternion(float4 *q)
|
void float4x4::Quaternion(float4 const *q)
|
||||||
{ // konwersja kwaternionu obrotu na macierz obrotu
|
{ // konwersja kwaternionu obrotu na macierz obrotu
|
||||||
float xx = q->x * q->x;
|
float xx = q->x * q->x;
|
||||||
float yy = q->y * q->y;
|
float yy = q->y * q->y;
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void Quaternion(float4 *q);
|
void Quaternion(float4 const *q);
|
||||||
inline float3 *TranslationGet()
|
inline float3 *TranslationGet()
|
||||||
{
|
{
|
||||||
return (float3 *)(e + 12);
|
return (float3 *)(e + 12);
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ void AirCoupler::Clear()
|
|||||||
/**
|
/**
|
||||||
* Looks for submodels in the model and updates pointers.
|
* Looks for submodels in the model and updates pointers.
|
||||||
*/
|
*/
|
||||||
void AirCoupler::Init(std::string const &asName, TModel3d *Model)
|
void AirCoupler::Init(std::string const &asName, TModel3d const *Model)
|
||||||
{
|
{
|
||||||
if (!Model)
|
if (!Model)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public:
|
|||||||
///Reset members.
|
///Reset members.
|
||||||
void Clear();
|
void Clear();
|
||||||
///Looks for submodels.
|
///Looks for submodels.
|
||||||
void Init(std::string const &asName, TModel3d *Model);
|
void Init(std::string const &asName, TModel3d const *Model);
|
||||||
///Loads info about coupler.
|
///Loads info about coupler.
|
||||||
void Load(cParser *Parser, TModel3d *Model);
|
void Load(cParser *Parser, TModel3d *Model);
|
||||||
int GetStatus() const;
|
int GetStatus() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user