17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 02:49:19 +02:00

refactor(sonar): scope single-use variables in if init-statements (cpp:S6004)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jerrrrycho
2026-10-10 15:44:18 +02:00
parent f8104bd0dd
commit 9b89a5d887
27 changed files with 78 additions and 175 deletions

View File

@@ -467,16 +467,14 @@ particle_manager::find( std::string const &Template ) {
auto const templatename { ToLower( Template ) };
// try to locate specified rail profile...
auto const lookup { m_sourcetemplates.find( templatename ) };
if( lookup != m_sourcetemplates.end() ) {
if( auto const lookup { m_sourcetemplates.find( templatename ) }; lookup != m_sourcetemplates.end() ) {
// ...if it works, we're done...
return &(lookup->second);
}
// ... and if it fails try to add the template to the database from a data file
smoke_source source;
cParser parser(templatepath + templatename + ".txt", cParser::buffer_FILE);
if (source.deserialize(parser))
if (cParser parser(templatepath + templatename + ".txt", cParser::buffer_FILE); source.deserialize(parser))
{
// if deserialization didn't fail finish source setup...
source.m_opacitymodifier.bind( &Global.SmokeFidelity );