From e7227518d5fc7a9eeec7f796f994f592e07b2112 Mon Sep 17 00:00:00 2001 From: TotallyMehis Date: Mon, 22 Jun 2020 15:30:26 +0300 Subject: [PATCH] Fix entity name matching not working properly --- mp/src/game/server/baseentity.cpp | 4 ++-- sp/src/game/server/baseentity.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mp/src/game/server/baseentity.cpp b/mp/src/game/server/baseentity.cpp index 9bd525a4..48ecae1c 100644 --- a/mp/src/game/server/baseentity.cpp +++ b/mp/src/game/server/baseentity.cpp @@ -2991,9 +2991,9 @@ FORCEINLINE bool NamesMatch( const char *pszQuery, string_t nameToMatch ) // simple ascii case conversion if ( cName == cQuery ) ; - else if ( cName - 'A' <= (unsigned char)'Z' - 'A' && cName - 'A' + 'a' == cQuery ) + else if ( (unsigned char)(cName - 'A') <= (unsigned char)('Z' - 'A') && (unsigned char)(cName - 'A' + 'a') == cQuery ) ; - else if ( cName - 'a' <= (unsigned char)'z' - 'a' && cName - 'a' + 'A' == cQuery ) + else if ( (unsigned char)(cName - 'a') <= (unsigned char)('z' - 'a') && (unsigned char)(cName - 'a' + 'A') == cQuery ) ; else break; diff --git a/sp/src/game/server/baseentity.cpp b/sp/src/game/server/baseentity.cpp index b42f2abe..9686c4bd 100644 --- a/sp/src/game/server/baseentity.cpp +++ b/sp/src/game/server/baseentity.cpp @@ -2987,9 +2987,9 @@ FORCEINLINE bool NamesMatch( const char *pszQuery, string_t nameToMatch ) // simple ascii case conversion if ( cName == cQuery ) ; - else if ( cName - 'A' <= (unsigned char)'Z' - 'A' && cName - 'A' + 'a' == cQuery ) + else if ( (unsigned char)(cName - 'A') <= (unsigned char)('Z' - 'A') && (unsigned char)(cName - 'A' + 'a') == cQuery ) ; - else if ( cName - 'a' <= (unsigned char)'z' - 'a' && cName - 'a' + 'A' == cQuery ) + else if ( (unsigned char)(cName - 'a') <= (unsigned char)('z' - 'a') && (unsigned char)(cName - 'a' + 'A') == cQuery ) ; else break;