Skip to content

Commit

Permalink
SpawnManager: Fix previous commit through move insertion
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Nov 29, 2023
1 parent 2bd3e03 commit f322337
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/game/Maps/SpawnManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ void SpawnManager::Update()
m_updated = true;
if (!m_deferredSpawns.empty()) // cannot insert during update
{
m_spawns.emplace_back(m_deferredSpawns);
m_spawns.reserve(m_spawns.size() + m_spawns.size());
std::move(std::begin(m_deferredSpawns), std::end(m_deferredSpawns), std::back_inserter(m_deferredSpawns));

This comment has been minimized.

Copy link
@insunaa

insunaa Nov 29, 2023

Contributor

I think you'd either want the back inserter for m_spawns instead and better yet std::insert should be faster and can be used with move iterators, too

m_deferredSpawns.clear();
}
auto now = m_map.GetCurrentClockTime();
Expand Down

0 comments on commit f322337

Please sign in to comment.