void MMatchFriendInfo::UpdateDesc()
{
	MMatchServer* pServer = MMatchServer::GetInstance();
	for (MMatchFriendList::iterator i=m_FriendList.begin(); i!= m_FriendList.end(); i++) 
	{
		MMatchFriendNode* pNode = (*i);
		pNode->szDescription[0] = NULL;

		MMatchObject* pObj = pServer->GetPlayerByName(pNode->szName);
		if (pObj) {
			char szDesc[CHANNELNAME_LEN*2]="";

			pNode->nState = pObj->GetPlace();
			MMatchChannel* pChannel = pServer->FindChannel(pObj->GetChannelUID());
			if (pChannel) {
				sprintf(szDesc, "Channel '%s'", pChannel->GetName());
				strncpy(pNode->szDescription, szDesc, MATCH_SIMPLE_DESC_LENGTH);
				pNode->szDescription[MATCH_SIMPLE_DESC_LENGTH-1] = NULL;
			} else {
				strcpy(pNode->szDescription, "Unknown Channel");
			}
		} else {
			pNode->nState = MMP_OUTSIDE;
			strcpy(pNode->szDescription, "Not Logged on");
		}
	}
}
Beispiel #2
0
MMatchChannel* MMatchChannelMap::Find(const MCHANNEL_TYPE nChannelType, const char* pszChannelName)
{
	if ((nChannelType < 0) || (nChannelType >= MCHANNEL_TYPE_MAX)) return NULL;

	for(map<MUID, MMatchChannel*>::iterator i = m_TypesChannelMap[nChannelType].begin(); 
		i != m_TypesChannelMap[nChannelType].end(); i++)
	{
		MMatchChannel* pChannel = (*i).second;
		if (strcmp(pChannel->GetName(), pszChannelName) == 0) return pChannel;
	}
	return NULL;
}