Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/system/ComponentManager.cpp
Show First 20 Lines • Show All 496 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
void CComponentManager::ResetState() | void CComponentManager::ResetState() | ||||
{ | { | ||||
// Delete all dynamic message subscriptions | // Delete all dynamic message subscriptions | ||||
m_DynamicMessageSubscriptionsNonsync.clear(); | m_DynamicMessageSubscriptionsNonsync.clear(); | ||||
m_DynamicMessageSubscriptionsNonsyncByComponent.clear(); | m_DynamicMessageSubscriptionsNonsyncByComponent.clear(); | ||||
// Delete all IComponents | // Delete all IComponents in reverse order of creation. | ||||
std::map<ComponentTypeId, std::map<entity_id_t, IComponent*> >::iterator iit = m_ComponentsByTypeId.begin(); | std::map<ComponentTypeId, std::map<entity_id_t, IComponent*> >::reverse_iterator iit = m_ComponentsByTypeId.rbegin(); | ||||
for (; iit != m_ComponentsByTypeId.end(); ++iit) | for (; iit != m_ComponentsByTypeId.rend(); ++iit) | ||||
{ | { | ||||
std::map<entity_id_t, IComponent*>::iterator eit = iit->second.begin(); | std::map<entity_id_t, IComponent*>::iterator eit = iit->second.begin(); | ||||
for (; eit != iit->second.end(); ++eit) | for (; eit != iit->second.end(); ++eit) | ||||
{ | { | ||||
eit->second->Deinit(); | eit->second->Deinit(); | ||||
m_ComponentTypesById[iit->first].dealloc(eit->second); | m_ComponentTypesById[iit->first].dealloc(eit->second); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 666 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator