Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/system/ComponentManager.cpp
Show First 20 Lines • Show All 891 Lines • ▼ Show 20 Lines | |||||
void CComponentManager::DestroyComponentsSoon(entity_id_t ent) | void CComponentManager::DestroyComponentsSoon(entity_id_t ent) | ||||
{ | { | ||||
m_DestructionQueue.push_back(ent); | m_DestructionQueue.push_back(ent); | ||||
} | } | ||||
void CComponentManager::FlushDestroyedComponents() | void CComponentManager::FlushDestroyedComponents() | ||||
{ | { | ||||
PROFILE2("Flush Destroyed Components"); | PROFILE3("Flush Destroyed Components"); | ||||
while (!m_DestructionQueue.empty()) | while (!m_DestructionQueue.empty()) | ||||
{ | { | ||||
// Make a copy of the destruction queue, so that the iterators won't be invalidated if the | // Make a copy of the destruction queue, so that the iterators won't be invalidated if the | ||||
// CMessageDestroy handlers try to destroy more entities themselves | // CMessageDestroy handlers try to destroy more entities themselves | ||||
std::vector<entity_id_t> queue; | std::vector<entity_id_t> queue; | ||||
queue.swap(m_DestructionQueue); | queue.swap(m_DestructionQueue); | ||||
for (std::vector<entity_id_t>::iterator it = queue.begin(); it != queue.end(); ++it) | for (std::vector<entity_id_t>::iterator it = queue.begin(); it != queue.end(); ++it) | ||||
▲ Show 20 Lines • Show All 267 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator