17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-07 08:48:01 +01:00

refactor(sonar): declare non-mutating member functions const (cpp:S5817)

Virtual functions are left untouched so overrides keep matching.
This commit is contained in:
jerrrrycho
2026-10-10 15:26:48 +02:00
parent 01d2b9bf82
commit 8042953b95
82 changed files with 221 additions and 221 deletions

View File

@@ -25,7 +25,7 @@ AirCoupler::~AirCoupler() = default;
* \return 2 when \(slanted\) TModel3d \c ModelxOn exists
* \return 0 when neither of them exist
*/
int AirCoupler::GetStatus()
int AirCoupler::GetStatus() const
{
if (ModelxOn)
return 2;

View File

@@ -30,7 +30,7 @@ public:
void Init(std::string const &asName, TModel3d *Model);
///Loads info about coupler.
void Load(cParser *Parser, TModel3d *Model);
int GetStatus();
int GetStatus() const;
inline void TurnOn() ///Turns on straight coupler.
{
On = true;

View File

@@ -27,7 +27,7 @@ public:
bool GetValue() const {
return m_state; }
inline
bool Active() {
bool Active() const {
return pModelOn != nullptr || pModelOff != nullptr; }
void Update( bool const Power = true );
bool Init( std::string const &asName, TModel3d const *pModel, bool bNewOn = false );
@@ -36,7 +36,7 @@ public:
// returns offset of submodel associated with the button from the model centre
glm::vec3 model_offset() const;
void gain(float new_volume);
inline uint8_t b() { return m_state ? 1 : 0; };
inline uint8_t b() const { return m_state ? 1 : 0; };
private:
// methods

View File

@@ -194,7 +194,7 @@ void TCamera::Update()
}
}
bool TCamera::SetMatrix( glm::dmat4 &Matrix ) {
bool TCamera::SetMatrix( glm::dmat4 &Matrix ) const {
Matrix = glm::rotate(Matrix, -(double)Angle.x, glm::dvec3(1, 0, 0));
Matrix = glm::rotate(Matrix, -(double)Angle.y, glm::dvec3(0, 1, 0)); // w zewnętrznym widoku: kierunek patrzenia

View File

@@ -22,7 +22,7 @@ class TCamera {
void OnCursorMove(double const x, double const y);
bool OnCommand( command_data const &Command );
void Update();
bool SetMatrix(glm::dmat4 &Matrix);
bool SetMatrix(glm::dmat4 &Matrix) const;
void RaLook();
glm::vec3 Angle; // pitch, yaw, roll

View File

@@ -457,7 +457,7 @@ float TGauge::GetScaledValue() const {
}
void
TGauge::UpdateAnimation( TSubModel *Submodel ) {
TGauge::UpdateAnimation( TSubModel *Submodel ) const {
if( Submodel == nullptr ) { return; }

View File

@@ -82,7 +82,7 @@ private:
float
GetScaledValue() const;
void
UpdateAnimation( TSubModel *Submodel );
UpdateAnimation( TSubModel *Submodel ) const;
// members
TGaugeAnimation m_animation { TGaugeAnimation::gt_Unknown }; // typ ruchu

View File

@@ -10167,7 +10167,7 @@ void TTrain::update_sounds(double const Deltatime)
update_sounds_radio();
}
void TTrain::update_sounds_resonancenoise(sound_source &Sound)
void TTrain::update_sounds_resonancenoise(sound_source &Sound) const
{
// frequency calculation
auto const normalizer{mvOccupied->Vmax * 0.01f};

View File

@@ -214,7 +214,7 @@ class TTrain {
// update function subroutines
void update_sounds( double const Deltatime );
void update_sounds_runningnoise( sound_source &Sound );
void update_sounds_resonancenoise( sound_source &Sound );
void update_sounds_resonancenoise( sound_source &Sound ) const;
void update_sounds_radio();
inline
end cab_to_end( int const End ) const {