patreeceeo / zomboban

Hey you should have clocked out hours aaAAAAAAAAAH!
https://innerlogic.co/game
0 stars 0 forks source link

fix 2x entity creation #13

Closed patreeceeo closed 1 month ago

patreeceeo commented 1 month ago

The logic for processing actions (normally, not in undo mode) was such pending actions were being tested for completeness and conditionally removed from the array in the same loop, meaning that when 2 or more actions were being processed simultaneously and they both finish in the same frame, only one would be removed, leading to the second action being processed once more than it ought to be.

This changes the logic such that the testing and removing are done in their own respective loops, and also encapsulates this logic in the existing filterInPlace method.