mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Destroy components in reverse order of construction.
Components have some initialisation-order dependency. They could also have destroy-order dependency, and from a RAII-like point of view, it makes sense to do this. Differential Revision: https://code.wildfiregames.com/D3843 This was SVN commit r25251.
This commit is contained in:
@@ -459,9 +459,9 @@ void CComponentManager::ResetState()
|
||||
m_DynamicMessageSubscriptionsNonsync.clear();
|
||||
m_DynamicMessageSubscriptionsNonsyncByComponent.clear();
|
||||
|
||||
// Delete all IComponents
|
||||
std::map<ComponentTypeId, std::map<entity_id_t, IComponent*> >::iterator iit = m_ComponentsByTypeId.begin();
|
||||
for (; iit != m_ComponentsByTypeId.end(); ++iit)
|
||||
// Delete all IComponents in reverse order of creation.
|
||||
std::map<ComponentTypeId, std::map<entity_id_t, IComponent*> >::reverse_iterator iit = m_ComponentsByTypeId.rbegin();
|
||||
for (; iit != m_ComponentsByTypeId.rend(); ++iit)
|
||||
{
|
||||
std::map<entity_id_t, IComponent*>::iterator eit = iit->second.begin();
|
||||
for (; eit != iit->second.end(); ++eit)
|
||||
|
||||
Reference in New Issue
Block a user