当前位置: 首页>>代码示例>>C++>>正文


C++ CKnights::ConstructChatPacket方法代码示例

本文整理汇总了C++中CKnights::ConstructChatPacket方法的典型用法代码示例。如果您正苦于以下问题:C++ CKnights::ConstructChatPacket方法的具体用法?C++ CKnights::ConstructChatPacket怎么用?C++ CKnights::ConstructChatPacket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CKnights的用法示例。


在下文中一共展示了CKnights::ConstructChatPacket方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RecvModifyFame

/***
 * We've been told from another server that a user's status in the clan has changed.
 ***/
void CUdpSocket::RecvModifyFame(char* pBuf, BYTE command)
{
	CString clanNotice;
	int index = 0, knightsindex = 0, vicechief = 0;
	char userid[MAX_ID_SIZE+1];

	knightsindex = GetShort(pBuf, index);
	if (!GetKOString(pBuf, userid, index, MAX_ID_SIZE))
		return;

	CUser *pTUser = g_pMain->GetUserPtr(userid, TYPE_CHARACTER);
	CKnights *pKnights = g_pMain->GetClanPtr(knightsindex);
	if (pKnights == NULL)
		return;

	switch (command)
	{
	case KNIGHTS_REMOVE:
	case KNIGHTS_REJECT:
		if (pTUser)
		{
			pTUser->SetClanID(0);
			pTUser->m_pUserData->m_bFame = 0;

			if (command == KNIGHTS_REMOVE)
				clanNotice = g_pMain->GetServerResource(IDS_KNIGHTS_REMOVE);
		}

		g_pMain->m_KnightsManager.RemoveKnightsUser(knightsindex, userid);
		break;

	case KNIGHTS_ADMIT:
		if (pTUser)
			pTUser->m_pUserData->m_bFame = KNIGHT;
		break;

	case KNIGHTS_CHIEF+0x10:
		if (pTUser)
		{
			pTUser->m_pUserData->m_bFame = CHIEF;
			clanNotice = g_pMain->GetServerResource(IDS_KNIGHTS_CHIEF);
		}
		break;

	case KNIGHTS_VICECHIEF+0x10:
		if (pTUser)
		{
			pTUser->m_pUserData->m_bFame = VICECHIEF;
			clanNotice = g_pMain->GetServerResource(IDS_KNIGHTS_VICECHIEF);
		}
		break;

	case KNIGHTS_OFFICER+0x10:
		if (pTUser)
			pTUser->m_pUserData->m_bFame = OFFICER;
		break;

	case KNIGHTS_PUNISH+0x10:
		if (pTUser)
			pTUser->m_pUserData->m_bFame = PUNISH;
		break;
	}

	if (pTUser != NULL)
		pTUser->SendClanUserStatusUpdate(command == KNIGHTS_REMOVE);

	if (clanNotice.GetLength() == 0)
		return;

	Packet result;

	// Construct the clan system chat packet
	pKnights->ConstructChatPacket(result, clanNotice, pTUser != NULL ? pTUser->m_pUserData->m_id : userid); 

	// If we've been removed from a clan, tell the user as well (since they're no longer in the clan)
	if (command == KNIGHTS_REMOVE && pTUser != NULL)
		pTUser->Send(&result);

	// Otherwise, since we're actually in the clan, we don't need to be explicitly told what happened.
	if (pKnights != NULL)
		pKnights->Send(&result);
}
开发者ID:DACRepair,项目名称:snoxd-koserver-1,代码行数:85,代码来源:UdpSocket.cpp


注:本文中的CKnights::ConstructChatPacket方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。