17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-30 23:40:29 +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,19 +25,19 @@ public:
virtual bool update() = 0;
// draws mode-specific user interface
inline
void render_ui() {
void render_ui() const {
if( m_userinterface != nullptr ) {
m_userinterface->render(); } }
inline
void begin_ui_frame() {
void begin_ui_frame() const {
if( m_userinterface != nullptr ) {
m_userinterface->begin_ui_frame(); } }
inline
void set_progress( float const Progress = 0.f, float const Subtaskprogress = 0.f ) {
void set_progress( float const Progress = 0.f, float const Subtaskprogress = 0.f ) const {
if( m_userinterface != nullptr ) {
m_userinterface->set_progress( Progress, Subtaskprogress ); } }
inline
void set_tooltip( std::string const &Tooltip ) {
void set_tooltip( std::string const &Tooltip ) const {
if( m_userinterface != nullptr ) {
m_userinterface->set_tooltip( Tooltip ); } }
// maintenance method, called when the mode is activated

View File

@@ -1057,7 +1057,7 @@ debug_panel::update_vehicle_brake() const {
}
void
debug_panel::update_section_engine( std::vector<text_line> &Output ) {
debug_panel::update_section_engine( std::vector<text_line> &Output ) const {
if( m_input.vehicle == nullptr ) { return; }
if( m_input.mover == nullptr ) { return; }
@@ -1138,7 +1138,7 @@ debug_panel::update_section_engine( std::vector<text_line> &Output ) {
}
void
debug_panel::update_section_ai( std::vector<text_line> &Output ) {
debug_panel::update_section_ai( std::vector<text_line> &Output ) const {
if( m_input.mover == nullptr ) { return; }
if( m_input.mechanik == nullptr ) { return; }
@@ -1262,7 +1262,7 @@ debug_panel::update_section_ai( std::vector<text_line> &Output ) {
}
void
debug_panel::update_section_scantable( std::vector<text_line> &Output ) {
debug_panel::update_section_scantable( std::vector<text_line> &Output ) const {
if( m_input.mechanik == nullptr ) { return; }
@@ -1284,7 +1284,7 @@ debug_panel::update_section_scantable( std::vector<text_line> &Output ) {
#ifdef WITH_UART
void
debug_panel::update_section_uart( std::vector<text_line> &Output ) {
debug_panel::update_section_uart( std::vector<text_line> &Output ) const {
uart_status *status = &UartStatus;
Output.emplace_back(
@@ -1312,7 +1312,7 @@ debug_panel::update_section_uart( std::vector<text_line> &Output ) {
#endif
void
debug_panel::update_section_scenario( std::vector<text_line> &Output ) {
debug_panel::update_section_scenario( std::vector<text_line> &Output ) const {
auto textline =
"vehicles: " + to_string( Timer::subsystem.sim_dynamics.average(), 2 ) + " msec"
@@ -1378,7 +1378,7 @@ debug_panel::update_section_eventqueue( std::vector<text_line> &Output ) {
}
void
debug_panel::update_section_powergrid( std::vector<text_line> &Output ) {
debug_panel::update_section_powergrid( std::vector<text_line> &Output ) const {
auto const lowpowercolor { glm::vec4( 164.0f / 255.0f, 132.0f / 255.0f, 84.0f / 255.0f, 1.f ) };
auto const nopowercolor { glm::vec4( 164.0f / 255.0f, 84.0f / 255.0f, 84.0f / 255.0f, 1.f ) };
@@ -1420,7 +1420,7 @@ debug_panel::update_section_powergrid( std::vector<text_line> &Output ) {
}
void
debug_panel::update_section_camera( std::vector<text_line> &Output ) {
debug_panel::update_section_camera( std::vector<text_line> &Output ) const {
if( m_input.camera == nullptr ) { return; }
@@ -1446,7 +1446,7 @@ debug_panel::update_section_camera( std::vector<text_line> &Output ) {
}
void
debug_panel::update_section_renderer( std::vector<text_line> &Output ) {
debug_panel::update_section_renderer( std::vector<text_line> &Output ) const {
// gfx renderer data
auto textline =
@@ -1526,7 +1526,7 @@ debug_panel::render_section( std::string const &Header, std::vector<text_line> c
}
bool
debug_panel::render_section( std::vector<text_line> const &Lines ) {
debug_panel::render_section( std::vector<text_line> const &Lines ) const {
for( auto const &line : Lines ) {
ImGui::PushStyleColor( ImGuiCol_Text, { line.color.r, line.color.g, line.color.b, line.color.a } );
@@ -1537,7 +1537,7 @@ debug_panel::render_section( std::vector<text_line> const &Lines ) {
return true;
}
bool debug_panel::render_section_developer()
bool debug_panel::render_section_developer() const
{
if (false == ImGui::CollapsingHeader("Developer tools"))
return false;
@@ -1553,7 +1553,7 @@ bool debug_panel::render_section_developer()
}
bool
debug_panel::render_section_settings() {
debug_panel::render_section_settings() const {
if( false == ImGui::CollapsingHeader( "Settings" ) ) { return false; }

View File

@@ -81,27 +81,27 @@ private:
// methods
// generate and send section data to provided output
void update_section_vehicle( std::vector<text_line> &Output );
void update_section_engine( std::vector<text_line> &Output );
void update_section_ai( std::vector<text_line> &Output );
void update_section_scantable( std::vector<text_line> &Output );
void update_section_scenario( std::vector<text_line> &Output );
void update_section_engine( std::vector<text_line> &Output ) const;
void update_section_ai( std::vector<text_line> &Output ) const;
void update_section_scantable( std::vector<text_line> &Output ) const;
void update_section_scenario( std::vector<text_line> &Output ) const;
void update_section_eventqueue( std::vector<text_line> &Output );
void update_section_powergrid( std::vector<text_line> &Output );
void update_section_camera( std::vector<text_line> &Output );
void update_section_renderer( std::vector<text_line> &Output );
void update_section_powergrid( std::vector<text_line> &Output ) const;
void update_section_camera( std::vector<text_line> &Output ) const;
void update_section_renderer( std::vector<text_line> &Output ) const;
#ifdef WITH_UART
void update_section_uart( std::vector<text_line> &Output );
void update_section_uart( std::vector<text_line> &Output ) const;
#endif
// section update helpers
std::string update_vehicle_coupler( int const Side );
std::string update_vehicle_brake() const;
// renders provided lines, under specified collapsing header
bool render_section( std::string const &Header, std::vector<text_line> const &Lines );
bool render_section( std::vector<text_line> const &Lines );
bool render_section( std::vector<text_line> const &Lines ) const;
bool render_section_scenario();
bool render_section_eventqueue();
bool render_section_settings();
bool render_section_developer();
bool render_section_settings() const;
bool render_section_developer() const;
// members
std::array<char, 1024> m_buffer;
std::array<char, 128> m_eventsearch;