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


C++ MyGetCurrentThreadID函数代码示例

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


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

示例1: Assert

uint WGNotifyMailHandler::Execute( WGNotifyMail* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	PlayerID_t PlayerID = pPacket->GetPlayerID() ;
	GamePlayer* pGamePlayer = g_pPlayerPool->GetPlayer(PlayerID) ;
	if( pGamePlayer==NULL )
	{
		Assert(FALSE) ;
		return PACKET_EXE_CONTINUE ;
	}

	Obj_Human* pHuman = pGamePlayer->GetHuman() ;
	Assert( pHuman ) ;

	Scene* pScene = pHuman->getScene() ;
	if( pScene==NULL ) return PACKET_EXE_CONTINUE ;

	if( pPlayer->IsServerPlayer() )
	{//服务器收到世界服务器发来的数据
		Assert( MyGetCurrentThreadID()==g_pServerManager->m_ThreadID ) ;

		pScene->SendPacket( pPacket, PlayerID ) ;

		g_pLog->FastSaveLog( LOG_FILE_1, "WGNotifyMailHandler: ServerPlayer MailCount=%d",
			pPacket->GetMailCount() ) ;

		return PACKET_EXE_NOTREMOVE ;
	}
	else if( pPlayer->IsGamePlayer() )
	{//场景收到Cache里的消息
		Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;

		GCNotifyMail Msg ;

		Msg.SetMailCount( pPacket->GetMailCount() ) ;

		pGamePlayer->SendPacket( &Msg ) ;

		g_pLog->FastSaveLog( LOG_FILE_1, "WGNotifyMailHandler: GamePlayer MailCount=%d",
			pPacket->GetMailCount() ) ;
	}
	else
	{
		Assert(FALSE) ;
	}

	return PACKET_EXE_CONTINUE ;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR ;
}
开发者ID:uvbs,项目名称:wx2Server,代码行数:53,代码来源:WGNotifyMailHandler.cpp

示例2: Assert

UINT CGCharMoodStateHandler::Execute( CGCharMoodState* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
	GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
	Assert( pGamePlayer != NULL ) ;
	if ( pGamePlayer == NULL )
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGCharMoodStateHandler: Error (pGamePlayer == NULL) " ) ;
		return PACKET_EXE_CONTINUE ;
	}

	Obj_Human* pHuman = pGamePlayer->GetHuman() ;
	Assert( pHuman != NULL ) ;
	if ( pHuman == NULL )
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGCharMoodStateHandler: Error (pHuman == NULL) " ) ;
		return PACKET_EXE_CONTINUE ;
	}

	Scene* pScene = pHuman->getScene() ;
	Assert( pScene != NULL ) ;
	if ( pScene == NULL )
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGCharMoodStateHandler: Error Obj = %d (pScene == NULL) ", pHuman->GetID() ) ;
		return PACKET_EXE_CONTINUE ;
	}

	//检查线程执行资源是否正确
	Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;
	if ( MyGetCurrentThreadID() != pScene->m_ThreadID )
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGCharMoodStateHandler: Error Obj = %d (MyGetCurrentThreadID() != pScene->m_ThreadID) ", pHuman->GetID() ) ;
		return PACKET_EXE_CONTINUE ;
	}

	ORESULT oResult = pHuman->GetHumanAI()->PushCommand_MoodState(pPacket->getMoodState());
	if ( OR_FAILED( oResult ) )
	{
		pHuman->SendOperateResultMsg(oResult);
	}

	g_pLog->FastSaveLog( LOG_FILE_1, "CGCharMoodStateHandler: ok obj=%d guid=%X scene=%d", 
		pHuman->GetID(), pHuman->GetGUID(), pScene->SceneID() ) ;

	return PACKET_EXE_CONTINUE ;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR ;
}
开发者ID:brock7,项目名称:TianLong,代码行数:50,代码来源:CGCharMoodStateHandler.cpp

示例3: Assert

uint CGCharStopLogicHandler::Execute( CGCharStopLogic* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
	GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
	Assert( pGamePlayer != NULL ) ;
	if ( pGamePlayer == NULL )
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGCharStopLogicHandler: Error (pGamePlayer == NULL) " ) ;
		return PACKET_EXE_CONTINUE ;
	}

	Obj_Human* pHuman = pGamePlayer->GetHuman() ;
	Assert( pHuman != NULL ) ;
	if ( pHuman == NULL )
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGCharStopLogicHandler: Error (pHuman == NULL) " ) ;
		return PACKET_EXE_CONTINUE ;
	}

	Scene* pScene = pHuman->getScene() ;
	Assert( pScene != NULL ) ;
	if ( pScene == NULL )
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGCharStopLogicHandler: Error Obj = %d (pScene == NULL) ", pHuman->GetID() ) ;
		return PACKET_EXE_CONTINUE ;
	}

	//检查线程执行资源是否正确
	Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;
	if ( MyGetCurrentThreadID() != pScene->m_ThreadID )
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGCharStopLogicHandler: Error Obj = %d (MyGetCurrentThreadID() != pScene->m_ThreadID) ", pHuman->GetID() ) ;
		return PACKET_EXE_CONTINUE ;
	}

	//中断当前技能逻辑
	AI_Human* pAI = pHuman->GetHumanAI();
	if(NULL!=pAI)
	{
		pAI->ForceInterruptSkill();
	}
	g_pLog->FastSaveLog( LOG_FILE_1, "CGCharStopLogicHandler: S:%d.", pPacket->getObjID()) ;

	return PACKET_EXE_CONTINUE ;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR ;
}
开发者ID:uvbs,项目名称:wx2Server,代码行数:49,代码来源:CGCharStopLogicHandler.cpp

示例4: Assert

uint	CGTopListHandler::Execute(CGTopList* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	GamePlayer* pGamePlayer = (GamePlayer*)pPlayer;
	Assert( pGamePlayer );

	Obj_Human* pHuman = pGamePlayer->GetHuman();
	Assert( pHuman );

	Scene* pScene = pHuman->getScene();
	if( pScene==NULL )
	{
		Assert(FALSE);
		return PACKET_EXE_ERROR;
	}

	//检查线程执行资源是否正确
	Assert( MyGetCurrentThreadID()==pScene->m_ThreadID );
	
	GWTopList* pMsg = (GWTopList*)g_pPacketFactoryManager->CreatePacket(PACKET_GW_TOP_LIST);
	pMsg->SetGUID(pHuman->GetGUID());
	pMsg->SetType(pPacket->GetType());
	g_pServerManager->SendPacket( pMsg, INVALID_ID );

	g_pLog->FastSaveLog( LOG_FILE_1, "CGTopListHandler: GUID=%X", pHuman->GetGUID() );

	return PACKET_EXE_CONTINUE;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR;
}
开发者ID:uvbs,项目名称:wx2Server,代码行数:33,代码来源:CGTopListHandler.cpp

示例5: Assert

uint CGLeaveSceneHandler::Execute( CGLeaveScene* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
	Assert( pGamePlayer ) ;

	Obj_Human* pHuman = pGamePlayer->GetHuman() ;
	Assert( pHuman ) ;

	Scene* pScene = pHuman->getScene() ;
	if( pScene==NULL ) return PACKET_EXE_CONTINUE ;

	//检查线程执行资源是否正确
	Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;





	g_pLog->FastSaveLog( LOG_FILE_1, "CGLeaveSceneHandler: " ) ;

	return PACKET_EXE_ERROR ;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR ;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:28,代码来源:CGLeaveSceneHandler.cpp

示例6: MyGetCurrentThreadID

UINT SSScenePlayerCountHandler::Execute(SSScenePlayerCount* pPacket, Player* pPlayer )
{
    __ENTER_FUNCTION    
    
        TID CurrentThreadID = MyGetCurrentThreadID();

        if(CurrentThreadID == g_pServerManager->m_ThreadID)
        {
            //修改g_WorldPlayerCounter 中数据
            Assert(pPacket);
            g_WorldPlayerCounter.m_WorldPlayerCount = pPacket->GetTotalPlayerCount();
            //修改场景负载数据
            //todo..
        }
        else
        {
            AssertEx(FALSE,"SSScenePlayerCountHandler 线程资源执行错误!");
        }
        
        Log::SaveLog(LOGIN_LOGFILE,"SSScenePlayerCountHandler::Execute()....OK,WorldPlayerCount = %d",
            g_WorldPlayerCounter.m_WorldPlayerCount);
        return PACKET_EXE_CONTINUE;

    __LEAVE_FUNCTION    

        return PACKET_EXE_ERROR;
}
开发者ID:gangzi4494,项目名称:web-pap,代码行数:27,代码来源:SSScenePlayerCountHandler.cpp

示例7: Assert

UINT    WGWorldTimeHandler::Execute(WGWorldTime* pPacket,Player* pPlayer)
{
    __ENTER_FUNCTION

        Assert( MyGetCurrentThreadID()==g_pServerManager->m_ThreadID );
        Assert(pPacket);

        g_WorldTime = pPacket->GetWorldTime();

        for( INT i=0; i<MAX_SCENE; i++ )
        {
            Scene* pScene = g_pSceneManager->GetScene( (SceneID_t)i ) ;
            if( pScene==NULL )
                continue ;

            if( pScene->GetPlayerManager()->GetCount()<=0 )
                continue ;
            
            GCWorldTime* pMsg = (GCWorldTime*)(g_pPacketFactoryManager->CreatePacket(PACKET_GC_WORLDTIME)) ;

            pMsg->SetWorldTime(g_WorldTime);
            pMsg->SetSceneID(pScene->SceneID());

            pScene->SendPacket(pMsg,INVALID_ID);

        }
        
        g_pLog->FastSaveLog( LOG_FILE_1,"WGWorldTimeHandler::Execute()....OK!");

        return PACKET_EXE_CONTINUE ;

    __LEAVE_FUNCTION

        return PACKET_EXE_ERROR ;
}
开发者ID:gangzi4494,项目名称:web-pap,代码行数:35,代码来源:WGWorldTimeHandler.cpp

示例8: ServerSocket

BOOL ServerManager::Init( )
{
__ENTER_FUNCTION

    m_pServerSocket = new ServerSocket( g_Config.m_BillingInfo.m_Port ) ;
    Assert( m_pServerSocket ) ;

    m_pServerSocket->setNonBlocking() ;

    m_SocketID = m_pServerSocket->getSOCKET() ;
    Assert( m_SocketID != INVALID_SOCKET ) ;

    FD_SET(m_SocketID , &m_ReadFDs[SELECT_BAK]);
    FD_SET(m_SocketID , &m_ExceptFDs[SELECT_BAK]);

    m_MinFD = m_MaxFD = m_SocketID;

    m_Timeout[SELECT_BAK].tv_sec = 0;
    m_Timeout[SELECT_BAK].tv_usec = 0;

    m_ThreadID = MyGetCurrentThreadID( ) ;

    for( int i=0; i<OVER_MAX_SERVER; i++ )
    {
        m_aServerHash[i] = INVALID_ID ;
    }


__LEAVE_FUNCTION

    return TRUE ;
}
开发者ID:gangzi4494,项目名称:web-pap,代码行数:32,代码来源:ServerManager.cpp

示例9: Assert

UINT CGExchangeSynchMoneyIIHandler::Execute( CGExchangeSynchMoneyII* pPacket, Player* pPlayer )
{
    __ENTER_FUNCTION

    GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
    Assert( pGamePlayer ) ;

    Obj_Human* pHuman = pGamePlayer->GetHuman() ;
    Assert( pHuman ) ;

    Scene* pScene = pHuman->getScene() ;
    if( pScene==NULL )
    {
        Assert(FALSE) ;
        return PACKET_EXE_ERROR ;
    }

    //检查线程执行资源是否正确
    Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;

    //验证
    EXCHANGE_CERTIFY_EACH_OTHER(pHuman)
    EXCHANGE_CERTIFY_ISLOCK(pHuman)

    ObjID_t    DestID = pHuman->m_ExchangBox.m_ObjID;
    Obj_Human* pDestHuman = pScene->GetHumanManager()->GetHuman( DestID );

    EXCHANGE_CERTIFY_STATUS(pHuman, EXCHANGE_SYNCH_DATA)
    EXCHANGE_CERTIFY_STATUS(pDestHuman, EXCHANGE_SYNCH_DATA)
    

    //操作
    UINT    Money     = pPacket->GetMoney();        

    if( Money<= pHuman->GetMoney() )
    {
        pHuman->m_ExchangBox.m_Money = Money;
        g_pLog->FastSaveLog( LOG_FILE_1, "<交易> [%s] 设置交易金钱 [%d]",    pHuman->GetName(), Money ) ;

        //金钱改变不发给自己了,省条消息
        GCExchangeSynchII MsgToTarget;
        MsgToTarget.SetIsMyself(FALSE);
        MsgToTarget.SetOpt(EXCHANGE_MSG::OPT_MONEY);
        MsgToTarget.SetMoney(Money);
        pDestHuman->GetPlayer()->SendPacket(&MsgToTarget);
        return PACKET_EXE_CONTINUE;
    }
    else
    {
        GCExchangeError Msg;
        Msg.SetID(EXCHANGE_MSG::ERR_ILLEGAL);
        pHuman->GetPlayer()->SendPacket(&Msg);
        pHuman->m_ExchangBox.CleanUp();
        return PACKET_EXE_CONTINUE;
    }
    
    __LEAVE_FUNCTION

        return PACKET_EXE_ERROR ;
}
开发者ID:gangzi4494,项目名称:web-pap,代码行数:60,代码来源:CGExchangeSynchMoneyIIHandler.cpp

示例10: MyGetCurrentThreadID

UINT    LBAskAuthHandler::Execute(LBAskAuth* pPacket, Player* pPlayer )
{
    __ENTER_FUNCTION
        
        TID CurrentThreadID = MyGetCurrentThreadID();
        
        if(CurrentThreadID == g_pServerManager->m_ThreadID)
        {
            Assert(pPacket);

            ServerPlayer* pServerPlayer  = (ServerPlayer*)pPlayer;

            Assert(pServerPlayer);

            pServerPlayer->SendPacket(pPacket);
        }
        else
        {
            AssertEx(FALSE,"LBAskAuthHandler 线程资源执行错误!");
        }
        
        Log::SaveLog(LOGIN_LOGFILE,"LBAskAuthHandler::Execute() ....OK");

        return PACKET_EXE_CONTINUE;

    __LEAVE_FUNCTION

        return PACKET_EXE_ERROR;
}
开发者ID:gangzi4494,项目名称:web-pap,代码行数:29,代码来源:LBAskAuthHandler.cpp

示例11: Assert

uint WGCountryVoteConfirmHandler::Execute( WGCountryVoteConfirm* pPacket, Player* pPlayer )
{
    __ENTER_FUNCTION

    PlayerID_t PlayerID = pPacket->GetPlayerID();
    GamePlayer* pGamePlayer = g_pPlayerPool->GetPlayer(PlayerID);
    if( pGamePlayer==NULL )
    {
        Assert(FALSE);
        return PACKET_EXE_CONTINUE;
    }

    Obj_Human* pHuman = pGamePlayer->GetHuman();
    Assert( pHuman );

    Scene* pScene = pHuman->getScene();
    if( pScene==NULL ) return PACKET_EXE_CONTINUE ;

    if( pPlayer->IsServerPlayer() )
    {   //服务器收到世界服务器发来的数据
        Assert( MyGetCurrentThreadID()==g_pServerManager->m_ThreadID );
        pScene->SendPacket( pPacket, PlayerID );
        return PACKET_EXE_NOTREMOVE;
    }
    else if( pPlayer->IsGamePlayer() )
    {   //场景收到Cache里的消息
        Assert( MyGetCurrentThreadID()==pScene->m_ThreadID );

        GCCountryVoteShow Msg;
        Msg.SetCurVotes(pPacket->GetCurNum());
        Msg.SetLeftTime(pPacket->GetTime());
        Msg.SetPercentVote( ((float)pPacket->GetPercent())/(100.0f));
        pGamePlayer->SendPacket( &Msg );

        g_pLog->FastSaveLog( LOG_FILE_1, "WGCountryVoteConfirmHandler: VoteOn Begin (Guid=%X)!", pHuman->GetGUID());
    }
    else
    {
        Assert(FALSE);
    }

    return PACKET_EXE_CONTINUE;

    __LEAVE_FUNCTION

    return PACKET_EXE_ERROR;
}
开发者ID:uvbs,项目名称:wx2Server,代码行数:47,代码来源:WGCountryVoteConfirmHandler.cpp

示例12: Assert

UINT CGAskDetailAbilityInfoHandler::Execute( CGAskDetailAbilityInfo* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

    GamePlayer* pGamePlayer = (GamePlayer*)pPlayer;
    Assert( pGamePlayer );

    Obj_Human* pHuman = pGamePlayer->GetHuman();
    Assert( pHuman );

    Scene* pScene = pHuman->getScene();
    if( pScene==NULL )
    {
        Assert(FALSE);
        return PACKET_EXE_ERROR;
    }

    //检查线程执行资源是否正确
    Assert( MyGetCurrentThreadID()==pScene->m_ThreadID );

    ObjID_t ObjID = pHuman->GetID();
    if( ObjID == INVALID_ID )
    {
        Assert(FALSE);
        return PACKET_EXE_ERROR;
    }

    Obj_Human *pTarget = (Obj_Human*)(pScene->GetObjManager()->GetObj(pPacket->getTargetID()));
    if( pTarget==NULL )
    {
        Assert( pTarget );
        return PACKET_EXE_ERROR;
    }

    // 权限判断
    // to be continue...
    if ( pTarget->GetObjType() != Obj::OBJ_TYPE_HUMAN )
    {
        return PACKET_EXE_ERROR;
    }

    GCDetailAbilityInfo Msg;

    Msg.setObjID( pTarget->GetID() );

    const _ABILITY_LIST *pAbilityList = pTarget->GetAbilityList();
    Msg.setAbilityList( g_pAbilityManager->MaxAbilityNum(), pAbilityList->m_aABility, pAbilityList->m_aPrescr );

    pGamePlayer->SendPacket( &Msg );

    g_pLog->FastSaveLog( LOG_FILE_1, "CGAskDetailAbilityInfoHandler: ok obj=%d scene=%d", 
        ObjID, pScene->SceneID() );

    return PACKET_EXE_CONTINUE;

__LEAVE_FUNCTION

    return PACKET_EXE_ERROR;
}
开发者ID:gangzi4494,项目名称:web-pap,代码行数:59,代码来源:CGAskDetailAbilityInfoHandler.cpp

示例13: Assert

uint CGAskJoinMenpaiHandler::Execute( CGAskJoinMenpai* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
	Assert( pGamePlayer ) ;

	Obj_Human* pHuman = pGamePlayer->GetHuman() ;
	Assert( pHuman ) ;

	Scene* pScene = pHuman->getScene() ;
	if( pScene==NULL )
	{
		Assert(FALSE) ;
		return PACKET_EXE_ERROR ;
	}

	//检查线程执行资源是否正确
	Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;

	
	
	//设置门派
	//pHuman->GetDB()->SetMenPai(pPacket->GetMenpaiID());

	//设置心法
	

	//设置技能
	

	//通知客户端加入的结果,由客户端自己去用模板内的数据改变自己的值
	//GCJoinMenpai Msg;
	//Msg.SetIsSucceedJoin(JOINMENPAI_SUCCEED);

	//pPlayer = pHuman->GetPlayer();
	//pPlayer->SendPacket( &Msg ) ;

	//INT nTemp = pPacket->GetMenpaiID();
	//INT nNum = g_XinFaDataMgr.m_nSize;

	//_XINFA_LIST   listMenpaiXinfa;

	//for(INT i=0,k=0; i<nNum; i++)
	//{
	//	if( g_XinFaDataMgr.m_vTemplateList[i].MenPai == nTemp)
	//		listMenpaiXinfa.m_aXinFa
	//}

	return PACKET_EXE_CONTINUE ;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR ;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:55,代码来源:CGAskJoinMenpaiHandler.cpp

示例14: Assert

uint CGLockTargetHandler::Execute( CGLockTarget* pPacket, Player* pPlayer )
{
	__ENTER_FUNCTION

	GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
	Assert( pGamePlayer ) ;

	Obj_Human* pHuman = pGamePlayer->GetHuman() ;

	if(NULL==pHuman)
	{
		AssertEx(FALSE,"[CGLockTargetHandler::Execute]: NULL Obj_Human pointer found!!");
		return PACKET_EXE_ERROR ;
	}
	Scene* pScene = pHuman->getScene() ;
	if( pScene==NULL )
	{
		Assert(FALSE) ;
		return PACKET_EXE_ERROR ;
	}

	//检查线程执行资源是否正确
	Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;

	ObjID_t nMeID = pHuman->GetID();
	if( nMeID == INVALID_ID )
	{
		Assert(FALSE) ;
		return PACKET_EXE_ERROR ;
	}
	//update target
	if(NULL==pPacket)
	{
		AssertEx(FALSE,"[CGLockTargetHandler::Execute]: NULL packet pointer found!!");
		return PACKET_EXE_ERROR ;
	}

	pHuman->SetLockedTarget(pPacket->getTargetID());
	// 当锁定的目标是NPC时将会触发NPC的泡泡说话
	Obj* pTarget = pScene->GetObjManager()->GetObj(pPacket->getTargetID());
	if (pTarget->GetObjType() == Obj::OBJ_TYPE_MONSTER)
	{
		((Obj_Monster*)pTarget)->ProcessPaoPao();
	}
	
	g_pLog->FastSaveLog( LOG_FILE_1, "CGLockTargetHandler: ok obj=%d scene=%d", 
		nMeID, pScene->SceneID() ) ;

	return PACKET_EXE_CONTINUE ;

	__LEAVE_FUNCTION

	return PACKET_EXE_ERROR ;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:54,代码来源:CGLockTargetHandler.cpp

示例15: Assert

UINT CGIssuePetPlacardHandler::Execute( CGIssuePetPlacard* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

    GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
    Assert( pGamePlayer ) ;

    Obj_Human* pHuman = pGamePlayer->GetHuman() ;
    Assert( pHuman ) ;
    
    Scene* pScene = pHuman->getScene() ;
    if( pScene==NULL )
    {
        Assert(FALSE) ;
        return PACKET_EXE_ERROR ;
    }

    //检查线程执行资源是否正确
    Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;

    Obj_Monster *pNpc = (Obj_Monster*)(pScene->GetObjManager()->GetObj(pPacket->GetNpcID()));
    if(pNpc != NULL)
    {
        PetPlacardSystem *pPetPlacardSystem = pNpc->GetPetPlacardSystem();
        if(pPetPlacardSystem == NULL)
        {
            pNpc->CreatePetPlacardSystem();
            pPetPlacardSystem = pNpc->GetPetPlacardSystem();
        }
        if(pPetPlacardSystem != NULL)
        {
            CHAR* pMessage = pPacket->GetMessage();
            BYTE nMessageSize = (BYTE)strlen( pMessage );
            if( nMessageSize >= PET_PLACARD_ITEM_MESSAGE_SIZE ) nMessageSize = PET_PLACARD_ITEM_MESSAGE_SIZE-1;
            pMessage[PET_PLACARD_ITEM_MESSAGE_SIZE-1] = 0;
            ReplaceIllegalString( pMessage, nMessageSize );

            ORESULT oResult = pPetPlacardSystem->IssuePlacard(pHuman, pPacket->GetGUID(), pMessage);
            if(OR_FAILED(oResult))
            {
                pHuman->SendOperateResultMsg(oResult);
            }
        }
    }

    return PACKET_EXE_CONTINUE ;

__LEAVE_FUNCTION

    return PACKET_EXE_ERROR ;
}
开发者ID:gangzi4494,项目名称:web-pap,代码行数:51,代码来源:CGIssuePetPlacardHandler.cpp


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