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


C++ USER::CleanUp方法代码示例

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


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

示例1: Execute


//.........这里部分代码省略.........
                break;
            }
        }
        else //用户不存在
        {
            Msg.SetResult(ASKCHARLOGIN_LOADDB_ERROR);
            Msg.SetAccount(pPacket->GetAccount());
            Msg.SetPlayerID(pPacket->GetPlayerID());
            Msg.SetPlayerGUID(CharGuid);
            Msg.SetHoldStatus(FALSE);
            pServerPlayer->SendPacket(&Msg);
            Log::SaveLog( WORLD_LOGFILE, "LWAskCharLoginHandler...No User,CharGUID = %X",CharGuid) ;
            return PACKET_EXE_CONTINUE;    
            

        }
    }
    else if(AskStatus == ALS_SENDDATA)
    {
        pUser = g_pOnlineUser->FindUser( CharGuid ) ;
        if( pUser )
        {//如果此用户存在
            Log::SaveLog( WORLD_LOGFILE, "LWAskCharLoginHandler...Char Exist! CharGUID = %X",CharGuid) ;
            return PACKET_EXE_CONTINUE;
        }

        ID_t    ServerID = g_Config.SceneID2ServerID(pPacket->GetUserData()->m_Human.m_StartScene);

        ServerPlayer* pFindPlayer = g_pServerManager->GetServerPlayer( ServerID ) ;
        if( pFindPlayer==NULL ) //服务器维护
        {
            WLRetCharLogin Msg;
            Msg.SetResult(ASKCHARLOGIN_SERVER_STOP);
            Msg.SetAccount(pPacket->GetAccount());
            Msg.SetPlayerID(pPacket->GetPlayerID());
            Msg.SetPlayerGUID(CharGuid);
            Msg.SetHoldStatus(FALSE);
            pServerPlayer->SendPacket(&Msg);
            Log::SaveLog( WORLD_LOGFILE, "LWAskCharLoginHandler...Server Stop CharGUID = %X",CharGuid) ;
            return PACKET_EXE_CONTINUE;
        }    


        pUser     = g_pOnlineUser->NewUser();

        if(!pUser) //满了
        {
            WLRetCharLogin Msg;
            Msg.SetResult(ASKCHARLIST_WORLD_FULL);
            Msg.SetAccount(pPacket->GetAccount());
            Msg.SetPlayerID(pPacket->GetPlayerID());
            Msg.SetPlayerGUID(CharGuid);
            Msg.SetHoldStatus(FALSE);
            pServerPlayer->SendPacket(&Msg);

            Log::SaveLog( WORLD_LOGFILE, "LWAskCharLoginHandler...World Full CharGUID = %X",CharGuid) ;
            return PACKET_EXE_CONTINUE;
        }

        pUser->CleanUp();

        FULLUSERDATA* pFullUserData = g_pOnlineUser->NewData();
        Assert(pFullUserData);
        memcpy(pFullUserData,pPacket->GetUserData(),sizeof(FULLUSERDATA));
        pUser->SetFullUserData( pFullUserData );
        pUser->SetKey( pPacket->GetUserKey() );
        pUser->SetUserStatus( US_HOLDUSERDATA );
        pUser->ResetKickTime() ;
        pUser->SetGUID( CharGuid );
        pUser->SetAccount( pPacket->GetAccount() );
        pUser->SetUserAge( pPacket->GetUserAge() );
        g_pOnlineUser->OnUserLogin( pUser ) ;

        Assert(pFullUserData->m_Human.m_StartScene!=INVALID_ID);
        Assert(pFullUserData->m_Human.m_StartScene<(INT)g_Config.m_SceneInfo.m_SceneCount);
        pUser->SetSceneID( pFullUserData->m_Human.m_StartScene );


        WLRetCharLogin Msg;
        Msg.SetResult(ASKCHARLOGIN_SUCCESS);
        Msg.SetAccount(pPacket->GetAccount());
        Msg.SetPlayerID(pPacket->GetPlayerID());
        Msg.SetPlayerGUID(CharGuid);
        Msg.SetHoldStatus(TRUE);
        Msg.SetPlayerServerID(pUser->GetServerID());
        pServerPlayer->SendPacket(&Msg);

        Log::SaveLog( WORLD_LOGFILE, "LWAskCharLoginHandler...ALSCENDDATA GUID=%X", CharGuid) ;
        return PACKET_EXE_CONTINUE;
    }

    
    Log::SaveLog( WORLD_LOGFILE, "LWAskCharLoginHandler::Execute()...GUID=%X OK",CharGuid) ;

    return PACKET_EXE_CONTINUE;

    __LEAVE_FUNCTION

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


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