Refactor team state unpacking

This commit is contained in:
Robert Müller 2023-01-03 23:27:00 +01:00
parent dfe0ec3385
commit 21636912c0

View file

@ -810,18 +810,10 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker, int Conn, bool Dumm
for(i = 0; i < MAX_CLIENTS; i++)
{
int Team = pUnpacker->GetInt();
bool WentWrong = false;
if(pUnpacker->Error())
WentWrong = true;
if(!WentWrong && Team >= TEAM_FLOCK && Team <= TEAM_SUPER)
const int Team = pUnpacker->GetInt();
if(!pUnpacker->Error() && Team >= TEAM_FLOCK && Team <= TEAM_SUPER)
m_Teams.Team(i, Team);
else
WentWrong = true;
if(WentWrong)
{
m_Teams.Team(i, 0);
break;