[TF2] Fix disguising as a player without primary weapon#1931
Open
leemustache wants to merge 1 commit into
Open
[TF2] Fix disguising as a player without primary weapon#1931leemustache wants to merge 1 commit into
leemustache wants to merge 1 commit into
Conversation
Contributor
|
Can you validate that clean up happens correctly with report_entities? This has a similar pattern to #1824 where i'd be worried about orphaning. Otherwise I think this makes sense. |
Author
|
Seems fine to me. This is after a couple of disguises from various classes to a demoman with booties. |
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.

Before
After
Reproduction steps
Explanation
(this video explains it)
DetermineDisguiseWeapongets called when Spy disguises or changes disguise weapon (the b key).This function, among other things, checks if there's a "previously held weapon" to fallback to when attempting to switch to an inaccessible weapon slot (primary slot for Demoman with boots, secondary slot for soldier with parachute etc).
This works well when guarding against changing disguise weapon to an invalid slot with the b key. But when changing disguise the
m_hDisguiseWeapondoesn't get cleared, so the "previous weapon" travels through different disguises.That makes it so if the primary slot is not available it tries to pick the previously held valid weapon. Which in the scenario described in the reproduction steps is the previous disguise's weapon.
This change clears the
m_hDisguiseWeaponfield every time a spy changes disguise, fixing the issue.