From f3ae0987b9b7b7c4b220f233fbd3957cc17e6c6a Mon Sep 17 00:00:00 2001 From: s1lent Date: Sun, 11 Aug 2019 03:01:49 +0700 Subject: [PATCH] SV_HandleClientMessage_api: loop break when got invalid message (as default behavior) --- rehlds/engine/sv_user.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rehlds/engine/sv_user.cpp b/rehlds/engine/sv_user.cpp index 381e014..4535117 100644 --- a/rehlds/engine/sv_user.cpp +++ b/rehlds/engine/sv_user.cpp @@ -1730,6 +1730,10 @@ void EXT_FUNC SV_HandleClientMessage_api(IGameClient* client, int8 opcode) { client_t* cl = client->GetClient(); if (opcode < clc_bad || opcode > clc_cvarvalue2) { + // TODO: Are we forced to use msg_badread for break the loop. + static_assert(REHLDS_API_VERSION_MAJOR <= 3, "Bump major API DETECTED!! You shall rework the hookchain, make function returnable"); + msg_badread = 1; + Con_Printf("SV_ReadClientMessage: unknown command char (%d)\n", opcode); SV_DropClient(cl, FALSE, "Bad command character in client command"); return; @@ -1772,7 +1776,8 @@ void SV_ExecuteClientMessage(client_t *cl) { #ifdef REHLDS_FIXES Con_Printf("SV_ReadClientMessage: badread on %s\n", host_client->name); - SV_ClientPrintf("Badread\n"); + if (host_client->active) + SV_ClientPrintf("Badread\n"); #else // REHLDS_FIXES Con_Printf("SV_ReadClientMessage: badread\n"); #endif // REHLDS_FIXES