ValveSoftware/source-sdk-2013 — pull request #50 by jimbomcb (2013-06-30 23:09:22+00:00)
Title: Fixed GameRules stringtable pointer never being reset

InstallStringTableCallback_GameRules will not update the stringtable changed callback if the stringtable pointer is not null. Currently the pointer is never set to null and the callback is never recreated meaning that clients will never receive the change (and will load the previous GameRules class) on subsequent map changes allowing them to go out of sync.

This pull request resets g_StringTableGameRules with the other stringtable pointers on level shutdown, allowing the client to recreate the GameRulesCreation change callback and load the correct GameRules class when updated.

You can replicate this issue by doing the following to the base 2013 MP code:
- Create an alternative GameRules (CHL2MPRulesAlternate) derived from "CHL2MPRules".
- Add a command to toggle between the two in InstallGameRules.
- Add two commands, one on the server and one on the client to report the currently loaded GameRules class.

Loading up the map and running the commands will show that while the client and the server have the correct GameRules loaded initially, they become out of sync after the first change.

] map dm_lockdown
] getgamerules_client
Gamerules: CHL2MPRules
] getgamerules_server
Gamerules: CHL2MPRules

] alt_gamerules 1
] map dm_lockdown
] getgamerules_client
Gamerules: CHL2MPRules
] getgamerules_server
Gamerules: CHL2MPRulesAlternate

After applying the attached commit, the stringtable pointer was correctly being reset, recreating the callback and working as intended.

] getgamerules_client
Client Gamerules: CHL2MPRules
] getgamerules_server
Server Gamerules: CHL2MPRules

] alt_gamerules 1
] map dm_lockdown
] getgamerules_client
Client Gamerules: CHL2MPRulesAlternate
] getgamerules_server
Server Gamerules: CHL2MPRulesAlternate