CTeam* CTeamMgr::GetTeamFromPlayerID(uint32 dwPlayerID) { // Look for the player on each team... CTeam* pTeam = GetFirstTeam(); while (pTeam) { CTeamPlayer* pPlayer = pTeam->GetFirstPlayer(); while (pPlayer) { if (pPlayer->GetID() == dwPlayerID) { return(pTeam); } pPlayer = pTeam->GetNextPlayer(pPlayer); } pTeam = GetNextTeam(pTeam); } // If we get here, we didn't find the player's team... return(NULL); }
LTBOOL CTeamMgr::CreateTeamTransIDs() { // Reset the list... ClearTeamTransIDs(); // Write out each player ID on each team... CTeam* pTeam = GetFirstTeam(); while (pTeam) { uint32 dwTeamID = pTeam->GetID(); CTeamPlayer* pPlayer = pTeam->GetFirstPlayer(); while (pPlayer) { uint32 dwPlayerID = pPlayer->GetID(); if (dwPlayerID < TM_MAX_PLAYERS) { m_aTeamTransIDs[dwPlayerID] = dwTeamID; } pPlayer = pTeam->GetNextPlayer(pPlayer); } pTeam = GetNextTeam(pTeam); } // All done... return(LTTRUE); }