⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 charnameuserlist.cpp

📁 奇迹世界 部分源代码奇迹世界 部分源代码奇迹世界 部分源代码
💻 CPP
字号:
#include "stdafx.h"
#include "CharNameUserList.h"
#include "User.h"
#include <assert.h>

CharNameUserList::CharNameUserList()
{
}

CharNameUserList::~CharNameUserList()
{
}

VOID CharNameUserList::Init()
{
}

VOID CharNameUserList::Release()
{
	m_mapUsers.clear();
}

VOID CharNameUserList::Add( std::string strCharName, User *pUser )
{
	// CharName阑 虐肺 蜡廉 眠啊
	CUSER_MAP_ITER it = m_mapUsers.find( strCharName );
	assert( it == m_mapUsers.end() );
	m_mapUsers.insert( CUSER_MAP_PAIR( strCharName, pUser ) );
	//MessageOut(eCRITICAL_LOG,  "某腐磐 眠啊(%d)(%s)", pUser->GetGUID(), strCharName.c_str() );
}

VOID CharNameUserList::Remove( std::string strCharName )
{
	// CharName阑 虐肺 窍绰 甘俊辑 力芭
	CUSER_MAP_ITER it = m_mapUsers.find( strCharName );
	if( it != m_mapUsers.end() )
	{
//		User *pUser = it->second;
//		if( !pUser )
//		{
//			MessageOut( eCRITICAL_LOG, "CharNameUserList::Remove Error - No User[%s] In Map", strCharName.c_str() );
//			return;
//		}
		m_mapUsers.erase( it );
		//MessageOut(eCRITICAL_LOG,  "某腐磐 力芭(%d)(%s)", pUser->GetGUID(), strCharName.c_str() );
	}
}

User* CharNameUserList::Find( std::string strCharName )
{
	CUSER_MAP_ITER it = m_mapUsers.find( strCharName );

	if( it != m_mapUsers.end() )
	{
		return it->second;
	}

	return NULL;
}

VOID CharNameUserList::SendToAll( BYTE *pMsg, WORD wSize )
{
	CUSER_MAP_ITER it;
	User *pUser;
	for( it = m_mapUsers.begin(); it != m_mapUsers.end(); ++it )
	{
		pUser = it->second;
		if( pUser )
		{
			pUser->Send( pMsg, wSize );
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -