uint8 CClientInfoMgr::GetNumPlayersOnTeam(uint8 nTeam) { if (nTeam > kNumTeams) { CLIENT_INFO* pLocal = GetLocalClient(); if (pLocal) nTeam = pLocal->nTeamID; } uint8 nCount = 0; CLIENT_INFO* ptr = m_pClients; while (ptr) { if (ptr->nTeamID == nTeam) nCount++; ptr = ptr->pNext; } return nCount; }
void CClientInfoMgr::UpdateFragDisplay () { if (!m_pClients || !g_pInterfaceMgr) return; if (m_hFragString) { g_pLTClient->FreeString(m_hFragString); m_hFragString = LTNULL; } if (m_hTeamScore) { g_pLTClient->FreeString(m_hTeamScore); m_hTeamScore = LTNULL; } if (m_hOppScore) { g_pLTClient->FreeString(m_hOppScore); m_hOppScore = LTNULL; } // get our local id CLIENT_INFO *pLocal = GetLocalClient(); if (!pLocal) return; char strTeam1[32]; char strTeam2[32]; char strPlayer[32]; sprintf(strTeam1,"%s: %d ",m_Teams[0].szName,m_Teams[0].nScore); sprintf(strTeam2,"%s: %d ",m_Teams[1].szName,m_Teams[1].nScore); if (pLocal->hstrName) sprintf(strPlayer,"%s: %d ",g_pLTClient->GetStringData(pLocal->hstrName),pLocal->nFrags); if (pLocal->team == 1) { m_hFragString = g_pLTClient->CreateString(strPlayer); m_hTeamScore = g_pLTClient->CreateString(strTeam1); m_hOppScore = g_pLTClient->CreateString(strTeam2); m_hTeamColor = m_Teams[0].hColor; m_hOppColor = m_Teams[1].hColor; } else if (pLocal->team == 2) { m_hFragString = g_pLTClient->CreateString(strPlayer); m_hTeamScore = g_pLTClient->CreateString(strTeam2); m_hOppScore = g_pLTClient->CreateString(strTeam1); m_hTeamColor = m_Teams[1].hColor; m_hOppColor = m_Teams[0].hColor; } else { sprintf(strPlayer,"%d ",pLocal->nFrags); m_hFragString = g_pLTClient->CreateString(strPlayer); m_hTeamColor = kWhite; } int nPos = 4; if (m_hTeamScore) { LTIntPt sz = g_pInterfaceResMgr->GetMsgForeFont()->GetTextExtents(m_hTeamScore); m_TeamPos.x = sz.x+4; m_TeamPos.y = nPos; nPos += sz.y; } if (m_hOppScore) { LTIntPt sz = g_pInterfaceResMgr->GetMsgForeFont()->GetTextExtents(m_hOppScore); m_OppPos.x = sz.x+4; m_OppPos.y = nPos; nPos += sz.y; nPos += 4; } if (m_hFragString) { LTIntPt sz = g_pInterfaceResMgr->GetMsgForeFont()->GetTextExtents(m_hFragString); m_FragPos.x = sz.x+4; m_FragPos.y = nPos; } }