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


C++ ServerInfoReportList::mutable_server_list方法代码示例

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


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

示例1: OnWorldInfoProcess

int NFCLoginToMasterModule::OnWorldInfoProcess(const int nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen)
{
	NFGUID nPlayerID ;	
	NFMsg::ServerInfoReportList xMsg;
	if (!NFINetModule::RecivePB(nSockIndex, nMsgID, msg, nLen, xMsg, nPlayerID))
	{
		return 0;
	}

	int nSize = xMsg.server_list_size();
	for (int i = 0; i < nSize; ++i)
	{
		const NFMsg::ServerInfoReport* pData = xMsg.mutable_server_list(i);

        NF_SHARE_PTR<NFMsg::ServerInfoReport> pServerData = mWorldMap.GetElement(pData->server_id());
        if (!pServerData.get())
        {
            pServerData = NF_SHARE_PTR<NFMsg::ServerInfoReport>(NF_NEW NFMsg::ServerInfoReport());
            *pServerData = *pData;

            mWorldMap.AddElement(pData->server_id(), pServerData);
        }
      
	}

    m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFGUID(0, nSize), "", "WorldInfo");

	return 0;
}
开发者ID:AnakinSong,项目名称:NoahGameFrame,代码行数:29,代码来源:NFCLoginToMasterModule.cpp

示例2: OnGameServerRegisteredProcess

int NFCWorldNet_ServerModule::OnGameServerRegisteredProcess(const NFIPacket& msg)
{
    NFIDENTID nPlayerID;
    NFMsg::ServerInfoReportList xMsg;
    if (!RecivePB(msg, xMsg, nPlayerID))
    {
        return 0;
    }

    for (int i = 0; i < xMsg.server_list_size(); ++i)
    {
        NFMsg::ServerInfoReport* pData = xMsg.mutable_server_list(i);
        NF_SHARE_PTR<ServerData> pServerData =  mGameMap.GetElement(pData->server_id());
        if (!pServerData.get())
        {
            pServerData = NF_SHARE_PTR<ServerData>(NF_NEW ServerData());
            mGameMap.AddElement(pData->server_id(), pServerData);
        }

        pServerData->nFD = msg.GetFd();
        *(pServerData->pData) = *pData;

         m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFIDENTID(0, pData->server_id()), pData->server_name(), "GameServerRegistered");
    }

    SynGameToProxy();

    return 0;
}
开发者ID:ming871,项目名称:NoahGameFrame,代码行数:29,代码来源:NFCWorldNet_ServerModule.cpp

示例3: OnRefreshWorldInfoProcess

int NFCMasterNet_ServerModule::OnRefreshWorldInfoProcess(const int nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen)
{
	NFGUID nPlayerID;
    NFMsg::ServerInfoReportList xMsg;
    if (!RecivePB(nSockIndex, nMsgID, msg, nLen, xMsg, nPlayerID))
    {
        return 0;
    }

    for (int i = 0; i < xMsg.server_list_size(); ++i)
    {
        NFMsg::ServerInfoReport* pData = xMsg.mutable_server_list(i);
        NF_SHARE_PTR<ServerData> pServerData =  mWorldMap.GetElement(pData->server_id());
        if (!pServerData.get())
        {
            pServerData = NF_SHARE_PTR<ServerData>(NF_NEW ServerData());
            mWorldMap.AddElement(pData->server_id(), pServerData);
        }

        pServerData->nFD = nSockIndex;
        *(pServerData->pData) = *pData;

        m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFGUID(0, pData->server_id()), pData->server_name(), "RefreshWorldInfo");

    }

	SynWorldToLogin();

	return 0;
}
开发者ID:huimiao638,项目名称:NoahGameFrame,代码行数:30,代码来源:NFCMasterNet_ServerModule.cpp

示例4: OnGameServerUnRegisteredProcess

int NFCWorldNet_ServerModule::OnGameServerUnRegisteredProcess(const NFIPacket& msg)
{
    NFIDENTID nPlayerID;
    NFMsg::ServerInfoReportList xMsg;
    if (!RecivePB(msg, xMsg, nPlayerID))
    {
        return 0;
    }

    for (int i = 0; i < xMsg.server_list_size(); ++i)
    {
        NFMsg::ServerInfoReport* pData = xMsg.mutable_server_list(i);
        mGameMap.RemoveElement(pData->server_id());

        m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFIDENTID(0, pData->server_id()), pData->server_name(), "GameServerRegistered");
    }
    return 0;
}
开发者ID:ming871,项目名称:NoahGameFrame,代码行数:18,代码来源:NFCWorldNet_ServerModule.cpp

示例5: OnServerInfoProcess

void NFCProxyServerToWorldModule::OnServerInfoProcess(const int nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen)
{
    NFGUID nPlayerID;	
    NFMsg::ServerInfoReportList xMsg;
    if (!NFINetModule::RecivePB(nSockIndex, nMsgID, msg, nLen, xMsg, nPlayerID))
    {
        return;
    }

    int nSize = xMsg.server_list_size();
    for (int i = 0; i < nSize; ++i)
    {
        const NFMsg::ServerInfoReport* pData = xMsg.mutable_server_list(i);
		
		//type
		ConnectData xServerData;

		xServerData.nGameID = pData->server_id();
		xServerData.strIP = pData->server_ip();
		xServerData.nPort = pData->server_port();
		xServerData.strName = pData->server_name();
		//xServerData.eState = pData->server_state();
		xServerData.eServerType = (NF_SERVER_TYPE)pData->server_type();

		switch (xServerData.eServerType)
		{
		case NF_SERVER_TYPE::NFST_GAME_SERVER:
			{
				m_pToGameServerClusterClient->AddServer(xServerData);
			}
			break;
		case NF_SERVER_TYPE::NFST_WORLD_SERVER:
			{
				NFIClusterClientModule::AddServer(xServerData);
			}
			break;
		default:
			break;
		}

    }
}
开发者ID:huimiao638,项目名称:NoahGameFrame,代码行数:42,代码来源:NFCProxyServerToWorldModule.cpp

示例6: OnLoginUnRegisteredProcess

int NFCMasterNet_ServerModule::OnLoginUnRegisteredProcess(const int nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen)
{
	NFGUID nPlayerID;
    NFMsg::ServerInfoReportList xMsg;
    if (!RecivePB(nSockIndex, nMsgID, msg, nLen, xMsg, nPlayerID))
    {
        return 0;
    }

    for (int i = 0; i < xMsg.server_list_size(); ++i)
    {
        NFMsg::ServerInfoReport* pData = xMsg.mutable_server_list(i);
        mLoginMap.RemoveElement(pData->server_id());

        m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFGUID(0, pData->server_id()), pData->server_name(), "LoginUnRegistered");

    }


	return 0;
}
开发者ID:huimiao638,项目名称:NoahGameFrame,代码行数:21,代码来源:NFCMasterNet_ServerModule.cpp


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