void C4Team::RecheckPlayers() { // check all players within the team for (int32_t i=0; i<iPlayerCount; ++i) { bool fIsValid = false; int32_t id; C4PlayerInfo *pInfo; if ((id = piPlayers[i])) if ((pInfo = Game.PlayerInfos.GetPlayerInfoByID(id))) if (pInfo->GetTeam() == GetID()) if (pInfo->IsUsingTeam()) fIsValid = true; // removal will decrease iPlayerCount, which will abort the loop earlier if (!fIsValid) RemoveIndexedPlayer(i--); } // now check for any new players in the team int32_t id = 0; C4PlayerInfo *pInfo; while ((pInfo = Game.PlayerInfos.GetNextPlayerInfoByID(id))) { id = pInfo->GetID(); if (pInfo->GetTeam() == GetID()) if (pInfo->IsUsingTeam()) if (!IsPlayerIDInTeam(id)) AddPlayer(*pInfo, false); } }