本文整理汇总了C++中nfmsg::ServerInfoReportList::server_list_size方法的典型用法代码示例。如果您正苦于以下问题:C++ ServerInfoReportList::server_list_size方法的具体用法?C++ ServerInfoReportList::server_list_size怎么用?C++ ServerInfoReportList::server_list_size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nfmsg::ServerInfoReportList
的用法示例。
在下文中一共展示了ServerInfoReportList::server_list_size方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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)
{
const NFMsg::ServerInfoReport& xData = xMsg.server_list(i);
NF_SHARE_PTR<ServerData> pServerData = mWorldMap.GetElement(xData.server_id());
if (!pServerData.get())
{
pServerData = NF_SHARE_PTR<ServerData>(NF_NEW ServerData());
mWorldMap.AddElement(xData.server_id(), pServerData);
}
pServerData->nFD = nSockIndex;
*(pServerData->pData) = xData;
m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFGUID(0, xData.server_id()), xData.server_name(), "RefreshWorldInfo");
}
SynWorldToLogin();
return 0;
}
示例2: OnRefreshDBServerInfoProcess
void NFCWorldNet_ServerModule::OnRefreshDBServerInfoProcess(const NFSOCK nSockIndex, const int nMsgID, const char * msg, const uint32_t nLen)
{
NFGUID nPlayerID;
NFMsg::ServerInfoReportList xMsg;
if (!m_pNetModule->ReceivePB(nMsgID, msg, nLen, xMsg, nPlayerID))
{
return;
}
for (int i = 0; i < xMsg.server_list_size(); ++i)
{
const NFMsg::ServerInfoReport& xData = xMsg.server_list(i);
NF_SHARE_PTR<ServerData> pServerData = mDBMap.GetElement(xData.server_id());
if (!pServerData)
{
pServerData = NF_SHARE_PTR<ServerData>(NF_NEW ServerData());
mDBMap.AddElement(xData.server_id(), pServerData);
}
pServerData->nFD = nSockIndex;
*(pServerData->pData) = xData;
m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFGUID(0, xData.server_id()), xData.server_name(), "Proxy Registered");
SynDBToGame(nSockIndex);
}
}
示例3: 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;
}
示例4: 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;
}
示例5: OnGameServerUnRegisteredProcess
void NFCWorldNet_ServerModule::OnGameServerUnRegisteredProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen)
{
NFGUID nPlayerID;
NFMsg::ServerInfoReportList xMsg;
if (!m_pNetModule->ReceivePB( nMsgID, msg, nLen, xMsg, nPlayerID))
{
return;
}
for (int i = 0; i < xMsg.server_list_size(); ++i)
{
const NFMsg::ServerInfoReport& xData = xMsg.server_list(i);
mGameMap.RemoveElement(xData.server_id());
m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFGUID(0, xData.server_id()), xData.server_name(), "GameServerRegistered");
}
}
示例6: 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;
}
示例7: 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;
}
}
}
示例8: OnServerInfoProcess
void NFCProxyServerToWorldModule::OnServerInfoProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen)
{
NFGUID nPlayerID;
NFMsg::ServerInfoReportList xMsg;
if (!NFINetModule::ReceivePB( nMsgID, msg, nLen, xMsg, nPlayerID))
{
return;
}
for (int i = 0; i < xMsg.server_list_size(); ++i)
{
const NFMsg::ServerInfoReport& xData = xMsg.server_list(i);
//type
ConnectData xServerData;
xServerData.nGameID = xData.server_id();
xServerData.strIP = xData.server_ip();
xServerData.nPort = xData.server_port();
xServerData.strName = xData.server_name();
//xServerData.eState = pData->server_state();
xServerData.eServerType = (NF_SERVER_TYPES)xData.server_type();
switch (xServerData.eServerType)
{
case NF_SERVER_TYPES::NF_ST_GAME:
{
m_pNetClientModule->AddServer(xServerData);
}
break;
case NF_SERVER_TYPES::NF_ST_WORLD:
{
m_pNetClientModule->AddServer(xServerData);
}
break;
default:
break;
}
}
}
示例9: 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;
}
示例10: OnServerInfoProcess
void NFCWorldNet_ServerModule::OnServerInfoProcess(const NFSOCK nSockIndex, const int nMsgID, const char * msg, const uint32_t nLen)
{
NFGUID nPlayerID;
NFMsg::ServerInfoReportList xMsg;
if (!NFINetModule::ReceivePB(nMsgID, msg, nLen, xMsg, nPlayerID))
{
return;
}
for (int i = 0; i < xMsg.server_list_size(); ++i)
{
const NFMsg::ServerInfoReport& xData = xMsg.server_list(i);
if (xData.server_type() == NF_SERVER_TYPES::NF_ST_WORLD)
{
NF_SHARE_PTR<ServerData> pServerData = mWorldMap.GetElement(xData.server_id());
if (!pServerData)
{
pServerData = NF_SHARE_PTR<ServerData>(NF_NEW ServerData());
mWorldMap.AddElement(xData.server_id(), pServerData);
}
pServerData->nFD = nSockIndex;
*(pServerData->pData) = xData;
m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFGUID(0, xData.server_id()), xData.server_name(), "GameServerRegistered");
}
}
//sync to proxy
SynWorldToProxy();
//sync to game
SynWorldToGame();
}