msgboard.cpp
来自「网络游戏魔域的服务端与客户端完整源代码 包括详细的说明文档与开发日志」· C++ 代码 · 共 68 行
CPP
68 行
// 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 + =
减小字号Ctrl + -
显示快捷键?