Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TF2] game_round_win crashes the server on KotH maps #4254

Open
doclic opened this issue Sep 8, 2022 · 2 comments
Open

[TF2] game_round_win crashes the server on KotH maps #4254

doclic opened this issue Sep 8, 2022 · 2 comments

Comments

@doclic
Copy link

doclic commented Sep 8, 2022

The game_round_win entity's RoundWin input crashes the game when playing on King of the Hill maps.
Apparently, this is due to an infinite loop in CTeamControlPointMaster::CalcNumRoundsRemaining.
This seems unlikely after doing more research, check my second comment.

@doclic
Copy link
Author

doclic commented Nov 4, 2022

After doing a bit more research, I found a way to go around the crash:
Setting the gamerules's m_bPlayingKoth variable to false prevents the game from crashing.
This makes we wonder if the error is actually from CTeamControlPointMaster::CalcNumRoundsRemaining as neither this function or CTFGameRules::SendWinPanelInfo (the function that calls CTeamControlPointMaster::CalcNumRoundsRemaining)
have any mention of m_bPlayingKoth or CTFGameRules::IsInKothMode.
Crash reports also indicate that CTFGameRules::SetWinningTeam is the culprit.

Edit: see my following comment.

@doclic
Copy link
Author

doclic commented Feb 25, 2025

Using the updated source-sdk-2013, I found that this was caused by an infinite loop in CTeamControlPointerMaster::CalcNumRoundsRemaining in game/server/team_control_point_master.cpp. This function tries to count how many mini-rounds are left for the input team to win before it wins the entire, but in KotH there are no mini-rounds, and this function wasn't made for that and ends up crashing. This can be fixed by adding this line to the beginning of CTeamControlPointerMaster::CalcNumRoundsRemaining:

	if (m_ControlPointRounds.Count() == 0) return 0;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants