Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entity Manager not resetting mFlagDeleteAll when no entities have been created #2

Closed
SirRamEsq opened this issue Sep 20, 2017 · 1 comment
Assignees

Comments

@SirRamEsq
Copy link
Owner

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.

@SirRamEsq
Copy link
Owner Author

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.

SirRamEsq added a commit that referenced this issue Jan 29, 2018
-#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant