You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Game would crash soon after loading map
EntityManager::ClearAllEntities would be called setting mFlagDeleteAll to true
Cleanup would be called
Because the map is currently empty, the flag would not be reset
later the map would crash
Is fixed, but needs a regression test.
The text was updated successfully, but these errors were encountered:
Entirely removed mFlagDelete from EntityMan. It would have caused further problems down the road.
For example, if an entity is created between ClearAllEntities and Cleanup, then the EntityManager would reset its current eid counter to EID_MIN and would think that there were no in use EIDs
By removing mFlagDeleteAll, the EntityManager will keep it's eid counter where it is when all entities are deleted, but the deleted entities' eid values will be added to the reclaimedEIDs vector.
Furthermore, by removing handling this special case, the code has become more simple, readable and predictable.
Lastly, a regression test was written that mimics the cause of this bug, even though the code that causes it (mFlagDeleteAll) has been completely removed.
-#1 Game would crash soon after loading map
EntityManager::ClearALlEntities would be called setting
mFlagDeleteAll to true
Cleanup would be called
Because the map is currently empty, the flag would not be reset
later the map would crash
-#2 Events for entiteis being deleted would be sent twice
once from the EntityManager
once from the ComponentManager
now only sent from the EntityManager
Game would crash soon after loading map
EntityManager::ClearAllEntities would be called setting mFlagDeleteAll to true
Cleanup would be called
Because the map is currently empty, the flag would not be reset
later the map would crash
Is fixed, but needs a regression test.
The text was updated successfully, but these errors were encountered: