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


C++ MCommand类代码示例

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


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

示例1: GetObject

void MMatchServer::OnAsyncBuyQuestItem( MAsyncJob* pJobReslt )
{
	MAsyncDBJob_BuyQuestItem* pJob = (MAsyncDBJob_BuyQuestItem*)pJobReslt;
	if( MASYNC_RESULT_SUCCEED != pJob->GetResult() ){ return; }

	MMatchObject* pPlayer = GetObject( pJob->GetPlayerUID() );
	if( NULL == pPlayer ) {	return; }

	MMatchCharInfo* pCharInfo = pPlayer->GetCharInfo();
	if( NULL == pCharInfo ) { return; }

	// 아이템 거래 카운트 증가. 내부에서 디비 업데이트 결정.
	pCharInfo->GetDBQuestCachingData().IncreaseShopTradeCount(pJob->GetItemCount());
	pCharInfo->m_nBP -= pJob->GetPrice();

	
	MCommand* pNewCmd = CreateCommand( MC_MATCH_RESPONSE_BUY_QUEST_ITEM, pJob->GetPlayerUID() );
	if( 0 == pNewCmd ) {
		mlog( "MMatchServer::OnResponseBuyQuestItem - new Command실패.\n" );
		return;
	}
	
	pNewCmd->AddParameter( new MCmdParamInt(MOK) );
	pNewCmd->AddParameter( new MCmdParamInt(pCharInfo->m_nBP) );
	PostSafeQueue( pNewCmd );

	// 퀘스트 아이템 리스트를 다시 전송함.
	OnRequestCharQuestItemList( pJob->GetPlayerUID() );
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:29,代码来源:MMatchServer_Async.cpp

示例2: MUID

MCommand* MMatchObjectCacheBuilder::GetResultCmd(MATCHCACHEMODE nMode, MCommandCommunicator* pCmdComm)
{
	MCommand* pCmd = pCmdComm->CreateCommand(MC_MATCH_OBJECT_CACHE, MUID(0,0));
	pCmd->AddParameter(new MCmdParamUChar(nMode));
	int nCount = (int)m_ObjectCacheList.size();
	void* pCacheArray = MMakeBlobArray(sizeof(MMatchObjCache), nCount);
	int nIndex=0;
	for (MMatchObjCacheList::iterator itor=m_ObjectCacheList.begin(); itor!=m_ObjectCacheList.end(); itor++) {
		MMatchObjCache* pTrgCache = (MMatchObjCache*)MGetBlobArrayElement(pCacheArray, nIndex++);
		MMatchObjCache* pSrcCache = (*itor);

		
		pTrgCache->SetInfo(pSrcCache->GetUID(), pSrcCache->GetName(), pSrcCache->GetClanName(),
						   pSrcCache->GetLevel(), pSrcCache->GetUGrade(), pSrcCache->GetPGrade()
						   , pSrcCache->GetRank(), pSrcCache->GetKillCount(), pSrcCache->GetDeathCount(), pSrcCache->GetDTGrade() );

		pTrgCache->SetFlags(pSrcCache->GetFlags());
		pTrgCache->SetCLID(pSrcCache->GetCLID());
		pTrgCache->SetEmblemChecksum(pSrcCache->GetEmblemChecksum());

		pTrgCache->AssignCostume(pSrcCache->GetCostume());
	}
	pCmd->AddParameter(new MCmdParamBlob(pCacheArray, MGetBlobArraySize(pCacheArray)));
	MEraseBlobArray(pCacheArray);

	return pCmd;
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:27,代码来源:MMatchObjCache.cpp

示例3: GetObject

void MMatchServer::OnAdminRequestKickPlayer(const MUID& uidAdmin, const char* szPlayer)
{
	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) 
	{
#ifdef LOCALE_KOREA
		pTargetObj->DisconnectHacker( MMHT_COMMAND_BLOCK_BY_ADMIN );
#else
		// Notify Message 필요 -> 관리자 전용 - 해결(특별한 메세지 필요 없음)
		
		Disconnect(pTargetObj->GetUID());
#endif
	} else {
		nRet = MERR_ADMIN_NO_TARGET;
	}

	MCommand* pNew = CreateCommand(MC_ADMIN_RESPONSE_KICK_PLAYER, MUID(0,0));
	pNew->AddParameter(new MCmdParamInt(nRet));
	RouteToListener(pObj, pNew);
}
开发者ID:kooksGame,项目名称:life-marvelous,代码行数:26,代码来源:MMatchServer_Admin.cpp

示例4: OutputDebugStr

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();
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:33,代码来源:MMatchActiveTrapMgr.cpp

示例5: GetNPCObject

bool MMatchNPCManager::Spawn(MUID& uidNPC, MUID& uidController, unsigned char nSpawnPositionIndex)
{
	MMatchObject* pObject = MMatchServer::GetInstance()->GetObject(uidController);
	if ((pObject) && (m_pStage))
	{
		MMatchNPCObject* pNPCObject = GetNPCObject(uidNPC);
		if (pNPCObject)
		{
			SetNPCObjectToControllerInfo(uidController, pNPCObject);

			// route cmd
			MCommand* pCmd = MMatchServer::GetInstance()->CreateCommand(MC_QUEST_NPC_SPAWN, uidController);
			pCmd->AddParameter(new MCmdParamUID(uidController));
			pCmd->AddParameter(new MCmdParamUID(uidNPC));
			pCmd->AddParameter(new MCmdParamUChar((unsigned char)pNPCObject->GetType()));
			pCmd->AddParameter(new MCmdParamUChar((unsigned char)nSpawnPositionIndex));
			MMatchServer::GetInstance()->RouteToBattle(m_pStage->GetUID(), pCmd);


//			#ifdef _DEBUG
//			char text[256];
//			sprintf(text, "Spawn(%u:%u) - (%u:%u)\n", uidNPC.High, uidNPC.Low, uidController.High, uidController.Low);
//			OutputDebugString(text);
//			#endif

			return true;
		}
	}
	return false;
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:30,代码来源:MMatchNPCObject.cpp

示例6: OnAsyncInsertEvent

void MMatchServer::OnAsyncInsertEvent( MAsyncJob* pJobResult )
{
	if( 0 == pJobResult )
		return;

	MAsyncDBJob_EventLog* pEventJob = 
		reinterpret_cast< MAsyncDBJob_EventLog* >( pJobResult );

	if( pEventJob->GetAnnounce().empty() )
		return;

	if( MASYNC_RESULT_SUCCEED == pJobResult->GetResult() )
	{
		MCommand* pCmd;
		AsyncEventObjVec::const_iterator it, end;
		const AsyncEventObjVec& EventObjList = pEventJob->GetEventObjList();

		end = EventObjList.end();
		for( it = EventObjList.begin(); it != end; ++it )
		{
			if( MUID(0, 0) != it->uidUser )
			{
				pCmd = CreateCommand( MC_MATCH_ANNOUNCE, it->uidUser );
				if( 0 != pCmd )
				{
					pCmd->AddParameter( new MCmdParamUInt(0) );
					pCmd->AddParameter( new MCmdParamStr(pEventJob->GetAnnounce().c_str()) );
					Post( pCmd );
				}
			}
		}
	}
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:33,代码来源:MMatchServer_Async.cpp

示例7: mlog

void MMatchServer::OnAsyncGetAccountItemList( MAsyncJob* pJobResult )
{
	MAsyncDBJob_GetAccountItemList* pJob = (MAsyncDBJob_GetAccountItemList*)pJobResult;

	if( MASYNC_RESULT_SUCCEED != pJob->GetResult() ) {
		mlog("GetAccountItemList Failed\n");
		return;
	}

	MMatchObject* pObj = GetObject( pJob->GetPlayerUID() );
	if( NULL == pObj ) return;

	if( !pJob->GetExpiredAccountItems().empty() ) {
		ResponseExpiredItemIDList(pObj, pJob->GetExpiredAccountItems());
	}

	const int nAccountItemCount = pJob->GetAccountItemCount();

	if (nAccountItemCount > 0) {
		MAccountItemNode* accountItems = pJob->GetAccountItemList();
		if( NULL == accountItems ) return;

		MCommand* pNew = CreateCommand(MC_MATCH_RESPONSE_ACCOUNT_ITEMLIST, pObj->GetUID());

		// 갖고 있는 아이템 리스트 전송
		int nCountableAccountItemCount = 0;
		for(int i = 0; i < nAccountItemCount; i++ ) {
			if( accountItems[i].nCount > 0 && accountItems[i].nItemID > 0 ) { 
				nCountableAccountItemCount++; 
			}
		}

		void* pItemArray = MMakeBlobArray(sizeof(MTD_AccountItemNode), nCountableAccountItemCount);		

		int nIndex = 0;
		for (int i = 0; i < nAccountItemCount; i++)
		{
			if( accountItems[i].nItemID == 0 ) continue;
			MTD_AccountItemNode* pItemNode = (MTD_AccountItemNode*)MGetBlobArrayElement(pItemArray, nIndex);			

			_ASSERTE( ((NULL != MGetMatchItemDescMgr()->GetItemDesc(accountItems[i].nItemID)) 
				|| (NULL != m_GambleMachine.GetGambleItemByGambleItemID(accountItems[i].nItemID)))
				&& "zitem.xml or GambleItem에 기술되어 있지 않는 아이템입니다." );

			if( accountItems[i].nCount > 0 ) {
				Make_MTDAccountItemNode(pItemNode, accountItems[i].nAIID, accountItems[i].nItemID
					, accountItems[i].nRentMinutePeriodRemainder, accountItems[i].nCount);

				nIndex++;

				if( nIndex == nCountableAccountItemCount ) { break;	}
			}			
		}

		pNew->AddParameter(new MCommandParameterBlob(pItemArray, MGetBlobArraySize(pItemArray)));
		MEraseBlobArray(pItemArray);

		PostSafeQueue( pNew );
	}
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:60,代码来源:MMatchServer_Async.cpp

示例8: CreateCommand

void MMatchClient::OnResponseAgentLogin()
{
	MCommand* pCmd = CreateCommand(MC_AGENT_PEER_BINDTCP, GetAgentServerUID());
	pCmd->AddParameter(new MCmdParamUID(GetPlayerUID()));
	Post(pCmd);	

	mlog("Logged in Agent, Bind TCP \n");
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:8,代码来源:MMatchClient.cpp

示例9: expand

void MComponent::expand( WString& c, const MCommand& cmd )
{
    if( cmd.size() > 0 ) {
        cmd.expand( c, _target, _config->nilTool(), _mask, NULL, _mode );
        c.concat( "\n" );
        _project->insertBlanks( c );
    }
}
开发者ID:MikeyG,项目名称:open-watcom-v2,代码行数:8,代码来源:mcompon.cpp

示例10: MCommandParameter

MCommandParameterCommand::MCommandParameterCommand(const MCommand& Command) : MCommandParameter(MPT_CMD)
{
	Size = Command.GetSize();
	Data = new char[Size];
	OwnsData = true;

	Command.GetData(Data, Size);
}
开发者ID:Asunaya,项目名称:RefinedGunz,代码行数:8,代码来源:MCommandParameter.cpp

示例11: expand

void MProject::expand( ContFile& pmak, const MCommand& cmd, const char* head )
{
    if( cmd.size() > 0 ) {
        pmak.printf( "%s\n", head );
        MCommand c;
        cmd.expand( c, &_filename, _config->nilTool(), "*", NULL, 0 );
        insertBlanks( c );
        pmak.puts( c );
        pmak.puts( "\n" );
    }
}
开发者ID:MikeyG,项目名称:open-watcom-v2,代码行数:11,代码来源:mproject.cpp

示例12: MCommand

void MMatchClient::CastStageBridgePeer(const MUID& uidChar, const MUID& uidStage)
{
	MCommand* pCmd = new MCommand(m_CommandManager.GetCommandDescByID(MC_MATCH_BRIDGEPEER), GetServerUID(), m_This);		
	pCmd->AddParameter(new MCommandParameterUID(uidChar));
	pCmd->AddParameter(new MCommandParameterUInt(0));	// 수신측에서 IP로 치환됨
	pCmd->AddParameter(new MCommandParameterUInt(0));		// 수신측에서 Port로 치환됨
	
	MSafeUDP* pSafeUDP = GetSafeUDP();
	SendCommandByUDP(pCmd, GetServerIP(), GetServerPeerPort());

	delete pCmd;
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:12,代码来源:MMatchClient.cpp

示例13: MCommand

MCommand* MCommandCommunicator::MakeCmdFromSaneTunnelingBlob(const MUID& Sender, const MUID& Receiver, 
	const void* pBlob, size_t Size)
{
	MCommand* pCmd = new MCommand();
	if (!pCmd->SetData((char*)pBlob, &m_CommandManager, (u16)Size))
	{
		delete pCmd;
		return nullptr;
	}

	pCmd->m_Sender = Sender;
	pCmd->m_Receiver = Receiver;

	return pCmd;
}
开发者ID:Asunaya,项目名称:RefinedGunz,代码行数:15,代码来源:MCommandCommunicator.cpp

示例14: mlog

MCommand* MMatchClient::MakeCmdFromTunnelingBlob(const MUID& uidSender, void* pBlob, int nBlobArrayCount)
{
	if (nBlobArrayCount != 1) 
	{
		mlog("MakeCmdFromTunnelingBlob: BlobArrayCount is not 1\n");
		return NULL;
	}

	char* pPacket = (char*)MGetBlobArrayElement(pBlob, 0);

	int nSize = MGetBlobArraySize(pBlob) - (sizeof(int) * 2);
	if ((nSize <= 0) || (nSize >= MAX_BLOB_SIZE))
	{
		mlog("MakeCmdFromTunnelingBlob: Blob Size Error(size = %d)\n", nSize);
		return NULL;
	}

	char* pData = new char[nSize];

	if (!m_PeerPacketCrypter.Decrypt(pPacket, nSize, pData, nSize))
	{
		delete [] pData;
		return NULL;
	}


	MCommand* pCmd = new MCommand();
	if (!pCmd->SetData(pData, &m_CommandManager))
	{
		delete [] pData;
		delete pCmd; 
		return NULL;
	}

	delete [] pData;

	pCmd->m_Sender = uidSender;
	pCmd->m_Receiver = m_This;

	MMatchPeerInfo* pPeer = FindPeer(uidSender);
	if (pPeer == NULL)
	{
		delete pCmd;
		return NULL;
	}

	return pCmd;
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:48,代码来源:MMatchClient.cpp

示例15: GetObject

void MMatchServer::AdminTerminalOutput(const MUID& uidAdmin, const char* szText)
{
	MMatchObject* pObj = GetObject(uidAdmin);
	if (pObj == NULL) return;

	// 관리자 권한을 가진 사람이 아니면 연결을 끊는다.
	if (pObj->GetAccountInfo()->m_nUGrade != MMUG_ADMIN)
	{
//		DisconnectObject(uidAdmin);		
		return;
	}

	char szMsg[65535];
	strcpy_safe(szMsg, szText);

	MCommand* pCmd = CreateCommand(MC_ADMIN_TERMINAL, MUID(0,0));
	pCmd->AddParameter(new MCmdParamUID(uidAdmin));
	pCmd->AddParameter(new MCmdParamStr(szMsg));

	RouteToListener(pObj, pCmd);
}
开发者ID:Asunaya,项目名称:RefinedGunz,代码行数:21,代码来源:MMatchAdmin.cpp


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