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

refactor(sonar): use try_emplace for map insertion (cpp:S6030)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jerrrrycho
2026-10-10 15:51:29 +02:00
parent 6547f7e967
commit 95bc9bd511
17 changed files with 64 additions and 64 deletions

View File

@@ -47,11 +47,11 @@ TModelsManager::LoadModel(std::string const &Name, std::string const &virtualNam
m_models.emplace_back();
auto model = m_models.back().LoadModel( Name, dynamic );
if( model != nullptr ) {
m_modelsmap.emplace( virtualName, m_models.size() - 1 );
m_modelsmap.try_emplace( virtualName, m_models.size() - 1 );
}
else {
m_models.pop_back();
m_modelsmap.emplace( virtualName, null_handle );
m_modelsmap.try_emplace( virtualName, null_handle );
}
return model;
}
@@ -113,7 +113,7 @@ TModelsManager::GetModel(std::string const &Name, bool const Dynamic, bool const
ErrorLog( "Bad file: failed to locate 3d model file \"" + filename + "\"", logtype::file );
}
// ...and link it with the error model slot
m_modelsmap.emplace( filename + postfix, null_handle );
m_modelsmap.try_emplace( filename + postfix, null_handle );
}
Global.asCurrentTexturePath = buftp; // odtworzenie ścieżki do tekstur
return model; // NULL jeśli błąd