Repository navigation
Conversation
… it is indexed EventListener.add(unit, event) and onCast(unit, ability) file a listener under the unit's index, and the library indexes the units a map creates in init only after every init block has run. In init the index is 0, so add warned and dropped the listener and onCast filed it under slot 0, where the unit's casts never reached it. A listener of a unit without an index now waits and is filed, in the order it was added, on the next timer tick, which comes after the indexing. One destroyed while it waits is not filed. A unit that still has no index then gets what it got before: the warning for add, slot 0 for casts.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0ebed43f46
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…iting for it unregisterEventsForUnit cleared the lists a unit's listeners are filed in, and a listener that was still waiting for the unit's index was filed afterwards, so it could fire after the cleanup. It now destroys the waiting ones as well. A waiting listener has a flag of its own instead of being told by its unit not being null, and a null unit is not queued at all, as it can never get an index.
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Fixes #433.
EventListener.add(unit, event)andEventListener.onCast(unit, ability)file a listener under the unit's index. The library indexes the units a map creates in init only after every init block has run (OnUnitEnterLeavedispatches them from anullTimer), so in init the index is 0.addthen warned and dropped the listener, andonCastfiled it under slot 0, where the unit's own casts never reached it. Global listeners were not affected, which is why only the unit variants looked broken.A listener of a unit without an index now waits and is filed, in the order it was added, on the next timer tick, which comes after the indexing. A listener destroyed while it waits is not filed. A unit that still has no index then gets what it got before: the warning for
add, slot 0 for casts. Nothing indexes early, soonUnitIndexlisteners of packages that initialise later still see every unit.Checked in the game, with a death listener on two units and a cast listener on a third, all registered in an init block, next to the same registrations made after init and from a
nullTimer: before, the three registered in init never ran and the others did; after, all run, each for its own unit only.grill typecheckandgrill test(522 of 522) pass.Not in this PR: a regression test, since it needs control of a map's init block, which the compiletime tests and the in-game suite do not have.