bool CScreenJoin::PreState_QueryDetails() { IServerDirectory *pServerDir = g_pClientMultiplayerMgr->GetServerDir(); // Get the active server if (m_nSelectedServer >= m_cServerList.size()) return true; pServerDir->SetActivePeer(m_cServerList[m_nSelectedServer].m_sAddress.c_str()); if (!pServerDir->QueueRequest(IServerDirectory::eRequest_Peer_Details)) return true; return true; }
void CScreenJoin::ReadCurServerList() { m_nSelectedServer = 0; IServerDirectory *pServerDir = g_pClientMultiplayerMgr->GetServerDir(); IServerDirectory::TPeerList cPeers = pServerDir->GetPeerList(); m_cServerList.resize(cPeers.size()); IServerDirectory::TPeerList::const_iterator iCurPeer = cPeers.begin(); TServerList::iterator iCurServer = m_cServerList.begin(); for (; iCurPeer != cPeers.end(); ++iCurPeer, ++iCurServer) { // Indicate that the server's an invalid entry until we get everything.. iCurServer->m_sAddress.clear(); char aStringBuffer[256]; // Point at this server if (!pServerDir->SetActivePeer(iCurPeer->c_str())) continue; // Read the name CAutoMessage cMsg; if (!pServerDir->GetActivePeerInfo(IServerDirectory::ePeerInfo_Name, cMsg)) continue; { CLTMsgRef_Read cRead(cMsg.Read()); cRead->ReadString(aStringBuffer, sizeof(aStringBuffer)); } iCurServer->m_sName = aStringBuffer; // Read the summary if (!pServerDir->GetActivePeerInfo(IServerDirectory::ePeerInfo_Summary, cMsg)) continue; { CLTMsgRef_Read cRead(cMsg.Read()); cRead->ReadString(aStringBuffer, sizeof(aStringBuffer)); iCurServer->m_sMap = aStringBuffer; iCurServer->m_nNumPlayers = cRead->Readuint8(); iCurServer->m_nMaxPlayers = cRead->Readuint8(); } // Ok, this one's valid iCurServer->m_sAddress = *iCurPeer; } }