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

📄 msgboard.cpp

📁 网络游戏魔域的服务端与客户端完整源代码 包括详细的说明文档与开发日志
💻 CPP
字号:
// MsgBoard.cpp: implementation of the CMsgBoard class.
//
//////////////////////////////////////////////////////////////////////

#include "MsgBoard.h"
#include "Hero.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CMsgMessageBoard::CMsgMessageBoard()
{
	Init();
	m_pInfo	=(MSG_Info *)m_bufMsg;
	m_StrPacker.SetBuf(m_pInfo->szBuf, _MAX_MSGSIZE-sizeof(MSG_Info)+1);
}

CMsgMessageBoard::~CMsgMessageBoard()
{

}

//-------------------------------------------------------------------

BOOL CMsgMessageBoard::Create(char* pbufMsg, DWORD dwMsgSize)
{
	if (!CNetMsg::Create(pbufMsg, dwMsgSize))
		return false;

	if(_MSG_MESSAGEBOARD != this->GetType())
		return false;
	
	return true;
}

//-------------------------------------------------------------------

BOOL CMsgMessageBoard::Create(unsigned short usIndex, unsigned char ucAction, unsigned short usChannel, char* pszStr)
{
	this->Init();

	// fill info now
	m_pInfo->usIndex = usIndex;
	m_pInfo->usChannel = usChannel;
	m_pInfo->ucAction = ucAction;
	m_pInfo->unMsgType	=_MSG_MESSAGEBOARD;
	if(pszStr)
		m_StrPacker.AddString(pszStr);
	m_pInfo->unMsgSize	=sizeof(MSG_Info)-1+m_StrPacker.GetSize();
	return true;
}

//-------------------------------------------------------------------
void CMsgMessageBoard::Process(void* pInfo)
{
	switch(m_pInfo->ucAction)
	{
	case MESSAGEBOARD_LIST:
		g_objHero.m_objBulletin.SetList(m_pInfo->usIndex, m_pInfo->usChannel, m_StrPacker);
		break;

	default:
		return;
	}
}
//-------------------------------------------------------------------

⌨️ 快捷键说明

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