Exemple #1
0
BOOL ServerManager::RemovePlayer( Player* pPlayer )
{
__ENTER_FUNCTION

	BOOL ret = FALSE ;

	ID_t	ServerID		=	((ServerPlayer*)pPlayer)->GetServerData()->m_ServerID ;
	BOOL	bUseShareMem	=   FALSE;	
	
	bUseShareMem = g_Config.m_WorldInfo.m_EnableShareMem;
	//第一步:清除PlayerManager中的信息
	ret = DelPlayer( pPlayer ) ;
	Assert( ret ) ;

	//第二步:清除PlayerPool中的信息,注意此步骤必须放在最后,
	//当调用此操作后,当前Player就有可能会被马上分配给新接入玩家
	((ServerPlayer*)pPlayer)->FreeOwn( ) ;

	//第三步:处理此服务器上玩家的状态
	if(bUseShareMem)
	{//开了共享内存的服务器只处理正常ShutDown
		g_pOnlineUser->ChangeUserStatus( ServerID ,US_WAIT_SHUTDOWN) ;
	}
	else
		g_pOnlineUser->RemoveUser(ServerID);

	//第四步: 修改m_aServerHash 保存的PlayerID 为INVALID_ID
	Assert( ServerID>=0 && ServerID<OVER_MAX_SERVER ) ;
	m_aServerHash[ServerID] = INVALID_ID ;

	


	Log::SaveLog( WORLD_LOGFILE, "ServerManager::RemovePlayer(PID:%d)...OK", pPlayer->PlayerID() ) ;

	return ret ;

__LEAVE_FUNCTION

	return FALSE ;
}
BOOL LoginPlayerManager::RemovePlayer( Player* pPlayer )
{
    __ENTER_FUNCTION

        BOOL ret = FALSE ;
        
        //第一步:清除PlayerManager中的信息
        ret = DelPlayer( pPlayer->PlayerID() ) ;
        Assert( ret ) ;

        //第二步:清除PlayerPool中的信息,注意此步骤必须放在最后,
        //当调用此操作后,当前Player就有可能会被马上分配给新接入玩家
        ( ( LoginPlayer* )pPlayer)->FreeOwn() ;


        Log::SaveLog( LOGIN_LOGFILE, "LoginPlayerManager::RemovePlayer( PID: %d )...OK", pPlayer->PlayerID() ) ;

        return ret ;

    __LEAVE_FUNCTION

        return FALSE ;
}
Exemple #3
0
BOOL ServerManager::RemovePlayer( Player* pPlayer )
{
__ENTER_FUNCTION

    BOOL ret = FALSE ;

    //第一步:清除PlayerManager中的信息
    ret = DelPlayer( pPlayer ) ;
    Assert( ret ) ;

    //第二步:清除PlayerPool中的信息,注意此步骤必须放在最后,
    //当调用此操作后,当前Player就有可能会被马上分配给新接入玩家
    ((ServerPlayer*)pPlayer)->FreeOwn() ;

    //第三步:处理此服务器上玩家的状态
    
    Log::SaveLog( "Billing", "ServerManager::RemovePlayer(PID:%d)...OK", pPlayer->PlayerID() ) ;

    return ret ;

__LEAVE_FUNCTION

    return FALSE ;
}
BOOL IncomingPlayerManager::RemovePlayer( Player* pPlayer )
{
__ENTER_FUNCTION

	BOOL ret = FALSE ;
	
	//第一步:清除PlayerManager中的信息
	ret = DelPlayer( pPlayer->PlayerID() ) ;
	Assert( ret ) ;

	//第二步:清除PlayerPool中的信息,注意此步骤必须放在最后,
	//当调用此操作后,当前Player就有可能会被马上分配给新接入玩家
//	((GamePlayer*)pPlayer)->ChooseFreeOwn(mRecyclePlayerManager) ;
	((GamePlayer*)pPlayer)->FreeOwn() ;


	Log::SaveLog( SERVER_LOGFILE, "IncomingPlayerManager::RemovePlayer(PID:%d)...OK", pPlayer->PlayerID() ) ;

	return ret ;

__LEAVE_FUNCTION

	return FALSE ;
}