本文整理汇总了C++中MCommand::Clone方法的典型用法代码示例。如果您正苦于以下问题:C++ MCommand::Clone方法的具体用法?C++ MCommand::Clone怎么用?C++ MCommand::Clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCommand
的用法示例。
在下文中一共展示了MCommand::Clone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnAdminRequestMutePlayer
void MMatchServer::OnAdminRequestMutePlayer(const MUID& uidAdmin, const char* szPlayer, const int nPenaltyHour)
{
MMatchObject* pObj = GetObject(uidAdmin);
if (pObj == NULL) return;
if (!IsAdminGrade(pObj)) return;
if ((strlen(szPlayer)) < 2) return;
int nRet = MOK;
MMatchObject* pTargetObj = GetPlayerByName(szPlayer);
if (pTargetObj != NULL)
{
pTargetObj->GetAccountPenaltyInfo()->SetPenaltyInfo(MPC_CHAT_BLOCK, nPenaltyHour);
const MPenaltyInfo* pPenaltyInfo = pTargetObj->GetAccountPenaltyInfo()->GetPenaltyInfo(MPC_CHAT_BLOCK);
if( m_MatchDBMgr.InsertAccountPenaltyInfo(pTargetObj->GetAccountInfo()->m_nAID
, pPenaltyInfo->nPenaltyCode, nPenaltyHour, pObj->GetAccountName()) == false )
{
pTargetObj->GetAccountPenaltyInfo()->ClearPenaltyInfo(MPC_CHAT_BLOCK);
nRet = MERR_ADNIN_CANNOT_PENALTY_ON_DB;
}
}
else
{
nRet = MERR_ADMIN_NO_TARGET;
}
MCommand* pNew = CreateCommand(MC_ADMIN_RESPONSE_MUTE_PLAYER, MUID(0,0));
pNew->AddParameter(new MCmdParamInt(nRet));
if( nRet == MOK ) {
RouteToListener(pTargetObj, pNew->Clone());
}
RouteToListener(pObj, pNew);
}
示例2: RouteTrapActivationForForcedEnterd
void MMatchActiveTrapMgr::RouteTrapActivationForForcedEnterd(MMatchActiveTrap* pTrap)
{
OutputDebugStr("Notify Trap activation to ForcedEnteredPlayer\n");
if (!pTrap || !pTrap->IsActivated()) { _ASSERT(0); return; }
if (!m_pStage) return;
int numTarget = (int)pTrap->m_vecUidForcedEntered.size();
if (numTarget <= 0) return;
void* pTrapArray = MMakeBlobArray(sizeof(MTD_ActivatedTrap), 1);
MTD_ActivatedTrap* pNode = (MTD_ActivatedTrap*)MGetBlobArrayElement(pTrapArray, 0);
Make_MTDActivatedTrap(pNode, pTrap);
MCommand* pCommand = MMatchServer::GetInstance()->CreateCommand(MC_MATCH_NOTIFY_ACTIATED_TRAPITEM_LIST, MUID(0,0));
pCommand->AddParameter(new MCommandParameterBlob(pTrapArray, MGetBlobArraySize(pTrapArray)));
MMatchObject* pObj;
for (int i=0; i<numTarget; ++i)
{
pObj = m_pStage->GetObj( pTrap->m_vecUidForcedEntered[i]);
if (!pObj) continue;
MCommand* pSendCmd = pCommand->Clone();
MMatchServer::GetInstance()->RouteToListener(pObj, pSendCmd);
}
delete pCommand;
MEraseBlobArray(pTrapArray);
pTrap->m_vecUidForcedEntered.clear();
}