UINT GWCityCloseSuccessHandler::Execute( GWCityCloseSuccess* pPacket, Player* pPlayer )
{
    __ENTER_FUNCTION

        ServerPlayer* pServerPlayer = (ServerPlayer*)pPlayer;
        _CITY_GUID    CityGuid = pPacket->GetCityGuid();

        City* pDelCity = g_pCityManager->GetCityByGuid(CityGuid);
        if(!pDelCity->IsLock())
        {//已经有人在删除此城市了
            Assert(FALSE);
            return PACKET_EXE_CONTINUE ;
        }

        SceneID_t CitySceneID = pDelCity->GetSceneID();

        GUID_t PlayerGuid = pDelCity->GetApplicantGuid();
        g_pCityManager->DelCityByGuid(CityGuid);

        WGCityCloseSuccess MsgToServer;
        MsgToServer.SetPlayerGuid(PlayerGuid);
        MsgToServer.SetSceneID(CitySceneID);
        pServerPlayer->SendPacket(&MsgToServer);
        
        return PACKET_EXE_CONTINUE ;

    __LEAVE_FUNCTION

        return PACKET_EXE_ERROR ;
}
Esempio n. 2
0
uint GWCityCloseHandler::Execute( GWCityClose* pPacket, Player* pPlayer )
{
	__ENTER_FUNCTION

		ServerPlayer* pServerPlayer = (ServerPlayer*)pPlayer;

		_CITY_GUID	  CityGuid		= pPacket->GetCityGuid();
		GUID_t		  PlayerGuid	= pPacket->GetPlayerGuid();
		WGCityError MsgError;

		USER* pUser = g_pOnlineUser->FindUser( PlayerGuid ) ;
		if( pUser==NULL )
		{
			Log::SaveLog( WORLD_LOGFILE, "GWCityCloseHandler...User GUID=%X not find!", 
				PlayerGuid) ;
			return PACKET_EXE_CONTINUE ;
		}

		City* pDelCity = g_pCityManager->GetCityByGuid(CityGuid);
		if(!pDelCity)
		{
			Log::SaveLog( WORLD_LOGFILE, "GWCityCloseHandler...User GUID world=%d poolpos=%d  not find!", 
				CityGuid.m_World, CityGuid.m_PoolPos) ;
			return PACKET_EXE_CONTINUE ;
		}

		if(pDelCity->IsLock())
		{//已经有人删除此城市了
			Log::SaveLog( WORLD_LOGFILE, "GWCityCloseHandler...User GUID world=%d poolpos=%d  not find!", 
				CityGuid.m_World, CityGuid.m_PoolPos) ;
			return PACKET_EXE_CONTINUE ;
		}
		
		pDelCity->SetApplicantGuid(PlayerGuid);
		pDelCity->SetLock(TRUE);
		
		WGCityClose MsgToServer;
		MsgToServer.SetSceneID(pDelCity->GetSceneID());
		MsgToServer.SetPlayerID(pUser->GetPlayerID());
		pServerPlayer->SendPacket(&MsgToServer);
		
		return PACKET_EXE_CONTINUE ;

	__LEAVE_FUNCTION

		return PACKET_EXE_ERROR ;
}