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

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

This commit is contained in:
jerrrrycho
2026-10-10 15:51:29 +02:00
parent 8d93367de7
commit f8c6e358bd
17 changed files with 64 additions and 64 deletions

View File

@@ -799,7 +799,7 @@ void command_queue::update()
for (auto c : m_active_continuous)
{
command_data data({c.first, GLFW_REPEAT, 0.0, 0.0, delta, false, glm::vec3()}); // todo: improve
auto lookup = m_commands.emplace( c.second, commanddata_sequence() );
auto lookup = m_commands.try_emplace( c.second, commanddata_sequence() );
// recipient stack was either located or created, so we can add to it quite safely
lookup.first->second.emplace_back( data );
}
@@ -809,7 +809,7 @@ void command_queue::update()
void
command_queue::push( command_data const &Command, uint32_t const Recipient ) {
if (is_network_target(Recipient)) {
auto lookup = m_intercept_queue.emplace(Recipient, commanddata_sequence());
auto lookup = m_intercept_queue.try_emplace(Recipient, commanddata_sequence());
lookup.first->second.emplace_back(Command);
} else {
push_direct(Command, Recipient);
@@ -827,7 +827,7 @@ void command_queue::push_direct(const command_data &Command, const uint32_t Reci
return;
}
auto lookup = m_commands.emplace( Recipient, commanddata_sequence() );
auto lookup = m_commands.try_emplace( Recipient, commanddata_sequence() );
// recipient stack was either located or created, so we can add to it quite safely
lookup.first->second.emplace_back( Command );
}