mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-21 22:34:58 +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.
This commit is contained in:
@@ -2311,7 +2311,7 @@ class TMoverParameters
|
||||
bool CurrentSwitch(bool const State);
|
||||
bool IsMotorOverloadRelayHighThresholdOn() const;
|
||||
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
|
||||
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);
|
||||
|
||||
@@ -1352,7 +1352,7 @@ void TMoverParameters::Derail(DerailReason const Reason)
|
||||
// *************************************************************************************************
|
||||
// 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))
|
||||
|
||||
@@ -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 ] ) ) *
|
||||
( 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;
|
||||
}
|
||||
|
||||
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)
|
||||
// cosGamma2 = SQR( cosf( gamma ) )
|
||||
return Zenithval * ( 1.0f + Perezcoeffs[ 0 ] * std::exp( Perezcoeffs[ 1 ] * Icostheta ) ) *
|
||||
|
||||
@@ -62,7 +62,7 @@ private:
|
||||
// coloring
|
||||
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 PerezFunctionO1( float 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 PerezFunctionO1( float const Perezcoeffs[ 5 ], const float Thetasun, 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);
|
||||
}
|
||||
|
||||
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)
|
||||
return 0;
|
||||
@@ -97,7 +97,7 @@ size_t piped_proc::read(unsigned char *buf, size_t len)
|
||||
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)
|
||||
return 0;
|
||||
|
||||
@@ -25,6 +25,6 @@ HANDLE pipe_wr = nullptr;
|
||||
public:
|
||||
explicit piped_proc(std::string cmd, bool write = false);
|
||||
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();
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
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_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_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;
|
||||
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
|
||||
if (Button == GLFW_MOUSE_BUTTON_LEFT && Action == GLFW_PRESS) {
|
||||
GfxRenderer->Pick_Node_Callback(
|
||||
[](scene::basic_node *node) {
|
||||
[](scene::basic_node const *node) {
|
||||
if( node == nullptr
|
||||
|| typeid(*node) != typeid(TAnimModel) )
|
||||
return;
|
||||
|
||||
@@ -124,7 +124,7 @@ gamepad_input::poll() {
|
||||
}
|
||||
|
||||
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 ) {
|
||||
// grab command(s) associated with the input pin
|
||||
|
||||
@@ -77,7 +77,7 @@ private:
|
||||
using inputaxis_sequence = std::vector<input_axis>;
|
||||
// methods
|
||||
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 process_axes();
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ Navigate([[maybe_unused]] std::string const &ClassName, [[maybe_unused]] UINT Ms
|
||||
}
|
||||
|
||||
void
|
||||
OnCommandGet(multiplayer::DaneRozkaz *pRozkaz)
|
||||
OnCommandGet(multiplayer::DaneRozkaz const *pRozkaz)
|
||||
{ // odebranie komunikatu z serwera
|
||||
if (pRozkaz->iSygn == EU07_MESSAGEHEADER )
|
||||
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 OnCommandGet( multiplayer::DaneRozkaz *pRozkaz );
|
||||
void OnCommandGet( multiplayer::DaneRozkaz const *pRozkaz );
|
||||
|
||||
void WyslijEvent( const std::string &e, const std::string &d );
|
||||
void WyslijString( const std::string &t, int n );
|
||||
|
||||
@@ -530,7 +530,7 @@ auto python_taskqueue::fetch_renderer(std::string const Renderer) -> PyObject *
|
||||
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)
|
||||
|
||||
@@ -132,7 +132,7 @@ class python_taskqueue
|
||||
using uploadtask_sequence = threading::lockable<std::deque<std::shared_ptr<render_task>>>;
|
||||
// methods
|
||||
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();
|
||||
|
||||
// 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) {
|
||||
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) {
|
||||
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) {
|
||||
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)
|
||||
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();
|
||||
|
||||
void notify_window_size(GLFWwindow *window, int w, int h) const;
|
||||
void notify_window_fb_size(GLFWwindow *window, int w, int h) const;
|
||||
void notify_cursor_pos(GLFWwindow *window, double x, double y) const;
|
||||
void notify_click(GLFWwindow *window, int button, int action) const;
|
||||
void notify_window_size(GLFWwindow const *window, int w, int h) const;
|
||||
void notify_window_fb_size(GLFWwindow const *window, int w, int h) const;
|
||||
void notify_cursor_pos(GLFWwindow const *window, double x, double y) 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);
|
||||
}
|
||||
|
||||
void float4x4::Quaternion(float4 *q)
|
||||
void float4x4::Quaternion(float4 const *q)
|
||||
{ // konwersja kwaternionu obrotu na macierz obrotu
|
||||
float xx = q->x * q->x;
|
||||
float yy = q->y * q->y;
|
||||
|
||||
@@ -253,7 +253,7 @@ public:
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
void Quaternion(float4 *q);
|
||||
void Quaternion(float4 const *q);
|
||||
inline float3 *TranslationGet()
|
||||
{
|
||||
return (float3 *)(e + 12);
|
||||
|
||||
@@ -49,7 +49,7 @@ void AirCoupler::Clear()
|
||||
/**
|
||||
* 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)
|
||||
return;
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
///Reset members.
|
||||
void Clear();
|
||||
///Looks for submodels.
|
||||
void Init(std::string const &asName, TModel3d *Model);
|
||||
void Init(std::string const &asName, TModel3d const *Model);
|
||||
///Loads info about coupler.
|
||||
void Load(cParser *Parser, TModel3d *Model);
|
||||
int GetStatus() const;
|
||||
|
||||
Reference in New Issue
Block a user