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

entities table is modified inside ipairs loop over entities #1467

Open
TheCycoONE opened this issue Sep 14, 2018 · 2 comments
Open

entities table is modified inside ipairs loop over entities #1467

TheCycoONE opened this issue Sep 14, 2018 · 2 comments
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

Comments

@TheCycoONE
Copy link
Member

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

@TheCycoONE TheCycoONE added S:Accepted State - Someone is interested in working on this but can still be picked up by someone else Type-Game Error S:Help wanted Development needed labels Sep 14, 2018
@lewri
Copy link
Member

lewri commented Jun 9, 2020

May be resolved by PR #1451

@TheCycoONE
Copy link
Member Author

Was not fixed in that PR.

@lewri lewri added bug issue type and removed Type-Game Error labels Jul 17, 2020
@lewri lewri added the T:Re-code Type label Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
Status: Todo
Status: Missed/Postponed
Development

Successfully merging a pull request may close this issue.

2 participants