NormalSHook erroring on non-IsInGame clients#1450
NormalSHook erroring on non-IsInGame clients#1450KyleSanderson merged 1 commit intoalliedmodders:masterfrom rtldg:normalsoundhook-thing
Conversation
Did you check if this is true for all engine versions SM supports? Did you actually test it on any? |
It looks like it has always checked if the client is active in both older and newer engine versions. |
|
I really don't remember why this was added, I think I hit a filter or something that crashed on a mid-connecting client. That's the reason this one hasn't been merged yet, I know it's painful but the only path to merge this one would be to test every game presently. |
|
Alternatively, how about removing the client from the |
I think that's a fine idea |
|
I force pushed a commit to remove clients from the edit: memmove(&players[i], &players[i+1], (size-i-1) * sizeof(int));
--i;
--size;this would be funny memmove(&players[i], &players[i+1], (size-- - --i) * sizeof(int)); |
asherkin
left a comment
There was a problem hiding this comment.
Thanks, I think this looks sane to me, but I'd like a 2nd ack for merge.
IEngineSound::EmitSoundseems to be called with clients in the filter that might not beIsInGame()which can throw an error when using aNormalSHookand returningPlugin_Changedsince all the clients will will be checked ifIsInGame().Using
CBroadcastRecipientFilterwould add all players than can be grabbed withUTIL_PlayerByIndexand is probably cause ofEmitSoundhaving clients that are notIsInGame().This PR has been changed to remove clients from the
playersarray that are notIsInGame(). Also a check for the callback-providedsizevariable has been addedpreviously
Removing the `IsInGame()` check should be fine since `EmitSound` eventually uses `CGameClient::IsActive()` to only send to active clients.EmitSound->EmitSoundInternal->SV_StartSound->sv.BroadcastSoundCGameClient->CBaseClientvirtual bool IsActive( void ) const { return m_nSignonState == SIGNONSTATE_FULL; };