From 7d2a18e96a71ab96365360abb03feb0628130ec5 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Sun, 4 Dec 2016 21:51:08 -0700 Subject: [PATCH] Don't call IClient::ClientPrintf on the bot twice The second time would be a nop anyway, so why bother. --- hltvserverwrapper.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/hltvserverwrapper.cpp b/hltvserverwrapper.cpp index 4a976a3..5ac3a39 100644 --- a/hltvserverwrapper.cpp +++ b/hltvserverwrapper.cpp @@ -254,12 +254,9 @@ void HLTVServerWrapper::OnCGameClient_ClientPrintf_Post(const char* buf) IClient *pClient = (IClient *)((intptr_t)pGameClient + 4); HandleClientPrintf(pClient, buf); -#if SOURCE_ENGINE == SE_LEFT4DEAD || SOURCE_ENGINE == SE_LEFT4DEAD2 - // Left4Dead doesn't check the netchan before using it + // We already called the function in HandleClientPrintf. + // Would crash or not do anything anyways. RETURN_META(MRES_SUPERCEDE); -#else - RETURN_META(MRES_IGNORED); -#endif } void HLTVServerWrapper::OnIClient_ClientPrintf_Post(const char* buf) @@ -267,12 +264,9 @@ void HLTVServerWrapper::OnIClient_ClientPrintf_Post(const char* buf) IClient *pClient = META_IFACEPTR(IClient); HandleClientPrintf(pClient, buf); -#if SOURCE_ENGINE == SE_LEFT4DEAD || SOURCE_ENGINE == SE_LEFT4DEAD2 - // Left4Dead doesn't check the netchan before using it + // We already called the function in HandleClientPrintf. + // Would crash or not do anything anyways. RETURN_META(MRES_SUPERCEDE); -#else - RETURN_META(MRES_IGNORED); -#endif } void HLTVServerWrapper::HandleClientPrintf(IClient *pClient, const char* buf)