Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Further reworking of event iteration interface
Fixes #2312. Turns out constructing a list of matching handlers breaks some undocumented behavior, namely events being executed in the order they're added (usually the order in which they appear in the WML). It also broke certain variable substitution by moving variable interpolation wholly before any event execution, as opposed to between each event. This commit implements an even simpler method: simply iterating through every registered handler in order, checking for a name match on each one, and if it passes, immediately executing the provided function. Cleanup will only occur once the toplevel call to execute_on_events is completed. This commit also removes the immediately cleanup upon removing a handler. This should ensure (I didn't test explicitly, but from other incidental issues I'm sure this is the case) the size of the main vector doesn't change during iteration. I also changed the pre-add standardization code to only affect event names without variables. Variable names are standardized later after variable substitution.
- Loading branch information
Showing
5 changed files
with
81 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters