TF2Tools: Prevent CalcIsAttackCriticalHelper* from being called twice#1573
Merged
peace-maker merged 2 commits intoalliedmodders:masterfrom Sep 23, 2021
Merged
TF2Tools: Prevent CalcIsAttackCriticalHelper* from being called twice#1573peace-maker merged 2 commits intoalliedmodders:masterfrom
peace-maker merged 2 commits intoalliedmodders:masterfrom
Conversation
peace-maker
approved these changes
Sep 4, 2021
Contributor
|
@peace-maker any chance at cherry-picking this for 1.10 as well? |
Member
No, 1.10 isn't getting any significant changes - the focus is on stabilising 1.11. |
Contributor
|
Is 1.11 not too stable right now? Ideally we shouldn't have to wait until 1.11 becomes stable to comfortably re-enable plugins that use this forward, but I've been out of the loop for a while so I don't know what the current issues are, if any, in 1.11. This also doesn't seem like a significant change for 1.10, more of a hotfix to bugged behavior that was introduced when this forward was reworked a while back. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CritManager::Hook_CalcIsAttackCriticalHelpers()is a pre-hook that calls the appropriate helper function, then passes the result over to plugins to determine whether the value should be changed.The issue is that
MRES_IGNOREDis used to return after calling the helper function if the result isPl_Continue, causing the helper function to be called a second time after the function, resulting in the server's crit calculations desyncing from the clients'. This PR stores the original return value and supercedes so it only ever gets called once.Tested on a fresh server with the below plugin to listen for crits (and to force the hook to be enabled). Without the fix, a Soldier's rocket may have glow without the sound or vice-versa; with the fix applied, the rocket will have both or neither.
thx @FlaminSarge for giving me something to do