17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-03 16:40:21 +01:00

refactor(sonar): access static members through the class (cpp:S2209)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jerrrrycho
2026-10-10 16:24:59 +02:00
parent 51337cb1b7
commit 24425d222f
5 changed files with 17 additions and 17 deletions

View File

@@ -1046,9 +1046,9 @@ debug_panel::update_section_engine( std::vector<text_line> &Output ) const {
for( int i = 0; i <= 20; ++i ) { for( int i = 0; i <= 20; ++i ) {
std::string parameters = std::string parameters =
mover.eimc_labels[ i ] + to_string( mover.eimc[ i ], 2, 9 ) TMoverParameters::eimc_labels[ i ] + to_string( mover.eimc[ i ], 2, 9 )
+ " | " + " | "
+ mover.eimv_labels[ i ] + to_string( mover.eimv[ i ], 2, 9 ); + TMoverParameters::eimv_labels[ i ] + to_string( mover.eimv[ i ], 2, 9 );
if( i < 10 ) { if( i < 10 ) {
parameters += parameters +=
@@ -1058,7 +1058,7 @@ debug_panel::update_section_engine( std::vector<text_line> &Output ) const {
parameters += " med:"; parameters += " med:";
} }
else if( i >= 13 ) { else if( i >= 13 ) {
parameters += " | " + vehicle.MED_labels[ i - 13 ] + to_string( vehicle.MED[ 0 ][ i - 13 ], 2, 9 ); parameters += " | " + TDynamicObject::MED_labels[ i - 13 ] + to_string( vehicle.MED[ 0 ][ i - 13 ], 2, 9 );
} }
Output.emplace_back( parameters, Global.UITextColor ); Output.emplace_back( parameters, Global.UITextColor );

View File

@@ -73,11 +73,11 @@ void gl::shader::expand_includes(std::string &str, const std::string &basedir)
size_t start_pos = 0; size_t start_pos = 0;
std::string magic = "#include"; std::string magic = "#include";
while ((start_pos = str.find(magic, start_pos)) != str.npos) while ((start_pos = str.find(magic, start_pos)) != std::string::npos)
{ {
size_t fp = str.find('<', start_pos); size_t fp = str.find('<', start_pos);
size_t fe = str.find('>', start_pos); size_t fe = str.find('>', start_pos);
if (fp == str.npos || fe == str.npos) if (fp == std::string::npos || fe == std::string::npos)
return; return;
std::string filename = str.substr(fp + 1, fe - fp - 1); std::string filename = str.substr(fp + 1, fe - fp - 1);
@@ -188,11 +188,11 @@ void gl::shader::parse_texture_entries(std::string &str)
size_t start_pos = 0; size_t start_pos = 0;
std::string magic = "#texture"; std::string magic = "#texture";
while ((start_pos = str.find(magic, start_pos)) != str.npos) while ((start_pos = str.find(magic, start_pos)) != std::string::npos)
{ {
size_t fp = str.find('(', start_pos); size_t fp = str.find('(', start_pos);
size_t fe = str.find(')', start_pos); size_t fe = str.find(')', start_pos);
if (fp == str.npos || fe == str.npos) if (fp == std::string::npos || fe == std::string::npos)
return; return;
std::istringstream ss(str.substr(fp + 1, fe - fp - 1)); std::istringstream ss(str.substr(fp + 1, fe - fp - 1));
@@ -242,11 +242,11 @@ void gl::shader::parse_param_entries(std::string &str)
size_t start_pos = 0; size_t start_pos = 0;
std::string magic = "#param"; std::string magic = "#param";
while ((start_pos = str.find(magic, start_pos)) != str.npos) while ((start_pos = str.find(magic, start_pos)) != std::string::npos)
{ {
size_t fp = str.find('(', start_pos); size_t fp = str.find('(', start_pos);
size_t fe = str.find(')', start_pos); size_t fe = str.find(')', start_pos);
if (fp == str.npos || fe == str.npos) if (fp == std::string::npos || fe == std::string::npos)
return; return;
std::istringstream ss(str.substr(fp + 1, fe - fp - 1)); std::istringstream ss(str.substr(fp + 1, fe - fp - 1));

View File

@@ -113,8 +113,8 @@ opengl33_particles::render() {
m_vao->setup_attrib(*m_buffer, 1, 4, GL_FLOAT, sizeof(particle_vertex), 12); m_vao->setup_attrib(*m_buffer, 1, 4, GL_FLOAT, sizeof(particle_vertex), 12);
m_vao->setup_attrib(*m_buffer, 2, 2, GL_FLOAT, sizeof(particle_vertex), 28); m_vao->setup_attrib(*m_buffer, 2, 2, GL_FLOAT, sizeof(particle_vertex), 28);
m_buffer->unbind(gl::buffer::ARRAY_BUFFER); gl::buffer::unbind(gl::buffer::ARRAY_BUFFER);
m_vao->unbind(); gl::vao::unbind();
} }
if (!m_shader) { if (!m_shader) {
@@ -130,9 +130,9 @@ opengl33_particles::render() {
glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(m_particlevertices.size())); glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(m_particlevertices.size()));
m_shader->unbind(); gl::program::unbind();
m_vao->unbind(); gl::vao::unbind();
m_buffer->unbind(gl::buffer::ARRAY_BUFFER); gl::buffer::unbind(gl::buffer::ARRAY_BUFFER);
return m_particlevertices.size() / 6; return m_particlevertices.size() / 6;
} }

View File

@@ -121,7 +121,7 @@ opengl33_precipitation::update() {
m_indexbuffer->upload(gl::buffer::ELEMENT_ARRAY_BUFFER, m_indices.data(), 0, m_indices.size() * sizeof( unsigned short )); m_indexbuffer->upload(gl::buffer::ELEMENT_ARRAY_BUFFER, m_indices.data(), 0, m_indices.size() * sizeof( unsigned short ));
m_vao->setup_ebo(*m_indexbuffer); m_vao->setup_ebo(*m_indexbuffer);
m_vao->unbind(); gl::vao::unbind();
// NOTE: vertex and index source data is superfluous past this point, but, eh // NOTE: vertex and index source data is superfluous past this point, but, eh
} }
@@ -155,5 +155,5 @@ opengl33_precipitation::render() {
::glDrawElements( GL_TRIANGLES, static_cast<GLsizei>( m_indices.size() ), GL_UNSIGNED_SHORT, reinterpret_cast<void const*>( 0 ) ); ::glDrawElements( GL_TRIANGLES, static_cast<GLsizei>( m_indices.size() ), GL_UNSIGNED_SHORT, reinterpret_cast<void const*>( 0 ) );
m_vao->unbind(); gl::vao::unbind();
} }

View File

@@ -44,7 +44,7 @@ void opengl33_skydome::update() {
m_indexbuffer->upload(gl::buffer::ELEMENT_ARRAY_BUFFER, skydome.indices().data(), 0, skydome.indices().size() * sizeof( unsigned short )); m_indexbuffer->upload(gl::buffer::ELEMENT_ARRAY_BUFFER, skydome.indices().data(), 0, skydome.indices().size() * sizeof( unsigned short ));
m_vao->setup_ebo(*m_indexbuffer); m_vao->setup_ebo(*m_indexbuffer);
m_vao->unbind(); gl::vao::unbind();
} }
// ship the current dynamic data to the gpu // ship the current dynamic data to the gpu
if (true == skydome.is_dirty() && m_coloursbuffer) { if (true == skydome.is_dirty() && m_coloursbuffer) {