mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
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:
parent
e9b59e72ff
commit
2f68b50fe1
|
@ -42,6 +42,7 @@ public:
|
||||||
void Reset();
|
void Reset();
|
||||||
void SetSolo(int ClientID, bool Value)
|
void SetSolo(int ClientID, bool Value)
|
||||||
{
|
{
|
||||||
|
dbg_assert(ClientID >= 0 && ClientID < MAX_CLIENTS, "Invalid client id");
|
||||||
m_IsSolo[ClientID] = Value;
|
m_IsSolo[ClientID] = Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue