[TF2] Fix flame manager lingering when changing class - #1984
Open
zxz41 wants to merge 1 commit into
Open
Conversation
Quick and dirty fix, but it's better than shipping something broken.
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.
Description
There's currently an issue where tf_flame_manager will sit around and take up an edict whenever the player changes class while a flame manager is active.
It would theoretically be possible to crash a server if the edict count is already very low, and since the flame manager will linger around for the duration of a round(?) Any round that takes over ~30 minutes could be crashed by a single person.
The reason why the entity linger around is a bit silly, whenever
BaseClass::Update()(AKACTFPointManager::Update()) gets called every time this entity thinks. There's some server side checks to see if it's time to remove itself.First the update functions sets
bUpdatePointsto true if there are any points in the list.source-sdk-2013/src/game/shared/tf/tf_point_manager.cpp
Line 244 in 88fa198
There might be some case (unsure) where we created the manager, but no points have been created yet.
The manager then proceeds to go through every point in the list if any to see if it should be removed. Otherwise it updates to update it's size bounds if applicable.
It then checks against the bool to see if there were actually points to update, if all the points are removed, it'll remove itself. Otherwise it applies the size to itself.
source-sdk-2013/src/game/shared/tf/tf_point_manager.cpp
Lines 291 to 304 in 88fa198
The issue is that, if it's list gets emptied outside of it's think function, the update function will just assume no points have been created yet.
I might try to do a more proper refactor on some of the point manager stuff, but for now this band aid solution will do rather than having this issue living rent free in the back of my head. It simply just uses
UTIL_Removelike most of everything else in theRemoveOwnedProjectilesfunction. The point manager is already set up to callClearPointsbefore being removed.The only regression caused by this, is that flame particles will be immediately removed, these were only visible client side. As the points for flames would only be removed on the server.