Assert client id in SetSolo

I could not find a way that an invalid client ID is used here, but
compiler warns anyway:

In member function ‘void CTeamsCore::SetSolo(int, bool)’,
    inlined from ‘void CCharacter::SetSolo(bool)’ at src/game/client/prediction/entities/character.cpp:29:22,
    inlined from ‘void CCharacter::HandleTiles(int)’ at src/game/client/prediction/entities/character.cpp:882:10:
src/game/teamscore.h:45:34: warning: array subscript [0, 63] is outside array bounds of ‘bool [64]’ [-Warray-bounds]
   45 |                 m_IsSolo[ClientID] = Value;
      |                 ~~~~~~~~~~~~~~~~~^
src/game/teamscore.h: In member function ‘void CCharacter::HandleTiles(int)’:
src/game/teamscore.h:27:14: note: while referencing ‘CTeamsCore::m_IsSolo’
   27 |         bool m_IsSolo[MAX_CLIENTS];
      |              ^~~~~~~~
This commit is contained in:
def 2022-05-14 11:27:59 +02:00
parent e9b59e72ff
commit 2f68b50fe1

View file

@ -42,6 +42,7 @@ public:
void Reset();
void SetSolo(int ClientID, bool Value)
{
dbg_assert(ClientID >= 0 && ClientID < MAX_CLIENTS, "Invalid client id");
m_IsSolo[ClientID] = Value;
}