entities table is modified inside ipairs loop over entities #1467
Labels
bug
issue type
S:Accepted
State - Someone is interested in working on this but can still be picked up by someone else
S:Help wanted
Development needed
T:Re-code
Type
Describe the issue
Whenever destroyEntities is called (which happens e.g. inside crashRoom), then the specified entity is removed from the entities table, and all indexes are updated accordingly.
This is a problem when it is called through entity:tick() (e.g. any action in the action_queue), because we are currently looping over entities during this removal, causing some entities to have their tick() method skipped.
The result is generally not noticeable.
Expected Behavior
It would be better to mark entities that should be removed, then perform the actual entity table manipulation later as a single action.
System Information
CorsixTH Version: 8f31878
Operating System: All
Theme Hospital Version: All
Additional Info
Further discussion is in #1451
The text was updated successfully, but these errors were encountered: