本文整理汇总了C++中nfmsg::ServerInfoReportList::add_server_list方法的典型用法代码示例。如果您正苦于以下问题:C++ ServerInfoReportList::add_server_list方法的具体用法?C++ ServerInfoReportList::add_server_list怎么用?C++ ServerInfoReportList::add_server_list使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nfmsg::ServerInfoReportList
的用法示例。
在下文中一共展示了ServerInfoReportList::add_server_list方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UnRegister
void NFCGameServerToWorldModule::UnRegister()
{
NF_SHARE_PTR<NFILogicClass> xLogicClass = m_pLogicClassModule->GetElement("GameServer");
if (xLogicClass.get())
{
NFList<std::string>& xNameList = xLogicClass->GetConfigNameList();
std::string strConfigName;
if (xNameList.Get(0, strConfigName))
{
const int nServerID = m_pElementInfoModule->GetPropertyInt(strConfigName, "ServerID");
const int nPort = m_pElementInfoModule->GetPropertyInt(strConfigName, "Port");
const int nMaxConnect = m_pElementInfoModule->GetPropertyInt(strConfigName, "MaxOnline");
const int nCpus = m_pElementInfoModule->GetPropertyInt(strConfigName, "CpuCount");
const std::string& strName = m_pElementInfoModule->GetPropertyString(strConfigName, "Name");
const std::string& strIP = m_pElementInfoModule->GetPropertyString(strConfigName, "IP");
NFMsg::ServerInfoReportList xMsg;
NFMsg::ServerInfoReport* pData = xMsg.add_server_list();
pData->set_server_id(nServerID);
pData->set_server_name(strName);
pData->set_server_cur_count(0);
pData->set_server_ip(strIP);
pData->set_server_port(nPort);
pData->set_server_max_online(nMaxConnect);
pData->set_server_state(NFMsg::EST_MAINTEN);
SendMsgPB(NFMsg::EGameMsgID::EGMI_GTW_GAME_UNREGISTERED, xMsg, GetNet()->FD());
m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFIDENTID(0, pData->server_id()), pData->server_name(), "UnRegister");
}
}
}
示例2: SynDBToGame
void NFCWorldNet_ServerModule::SynDBToGame(const NFSOCK nFD)
{
NFMsg::ServerInfoReportList xData;
NF_SHARE_PTR<ServerData> pServerData = mDBMap.First();
while (pServerData)
{
NFMsg::ServerInfoReport* pData = xData.add_server_list();
*pData = *(pServerData->pData);
pServerData = mDBMap.Next();
}
m_pNetModule->SendMsgPB(NFMsg::EGameMsgID::EGMI_STS_NET_INFO, xData, nFD);
}
示例3: SynGameToProxy
void NFCWorldNet_ServerModule::SynGameToProxy( const int nFD )
{
NFMsg::ServerInfoReportList xData;
NF_SHARE_PTR<ServerData> pServerData = mGameMap.First();
while (pServerData.get())
{
NFMsg::ServerInfoReport* pData = xData.add_server_list();
*pData = *(pServerData->pData);
pServerData = mGameMap.Next();
}
SendMsgPB(NFMsg::EGameMsgID::EGMI_STS_NET_INFO, xData, nFD);
}
示例4: Register
void NFCWorldToMasterModule::Register(NFINet* pNet)
{
NF_SHARE_PTR<NFIClass> xLogicClass = m_pClassModule->GetElement(NFrame::Server::ThisName());
if (xLogicClass)
{
NFList<std::string>& strIdList = xLogicClass->GetIdList();
std::string strId;
for (bool bRet = strIdList.First(strId); bRet; bRet = strIdList.Next(strId))
{
const int nServerType = m_pElementModule->GetPropertyInt(strId, NFrame::Server::Type());
const int nServerID = m_pElementModule->GetPropertyInt(strId, NFrame::Server::ServerID());
if (nServerType == NF_SERVER_TYPES::NF_ST_WORLD && pPluginManager->GetAppID() == nServerID)
{
const int nPort = m_pElementModule->GetPropertyInt(strId, NFrame::Server::Port());
const int nMaxConnect = m_pElementModule->GetPropertyInt(strId, NFrame::Server::MaxOnline());
const int nCpus = m_pElementModule->GetPropertyInt(strId, NFrame::Server::CpuCount());
const std::string& strName = m_pElementModule->GetPropertyString(strId, NFrame::Server::Name());
const std::string& strIP = m_pElementModule->GetPropertyString(strId, NFrame::Server::IP());
NFMsg::ServerInfoReportList xMsg;
NFMsg::ServerInfoReport* pData = xMsg.add_server_list();
pData->set_server_id(nServerID);
pData->set_server_name(strName);
pData->set_server_cur_count(0);
pData->set_server_ip(strIP);
pData->set_server_port(nPort);
pData->set_server_max_online(nMaxConnect);
pData->set_server_state(NFMsg::EST_NARMAL);
pData->set_server_type(nServerType);
NFMsg::ServerInfoExt pb_ServerInfoExt;
pData->mutable_server_info_list_ext()->CopyFrom(pb_ServerInfoExt);
NF_SHARE_PTR<ConnectData> pServerData = m_pNetClientModule->GetServerNetInfo(pNet);
if (pServerData)
{
int nTargetID = pServerData->nGameID;
m_pNetClientModule->SendToServerByPB(nTargetID, NFMsg::EGameMsgID::EGMI_MTL_WORLD_REGISTERED, xMsg);
m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFGUID(0, pData->server_id()), pData->server_name(), "Register");
}
}
}
}
}
示例5: Register
void NFCGameServerToWorldModule::Register(NFINet* pNet)
{
//成功就注册
NF_SHARE_PTR<NFILogicClass> xLogicClass = m_pLogicClassModule->GetElement("Server");
if (xLogicClass.get())
{
NFList<std::string>& xNameList = xLogicClass->GetConfigNameList();
std::string strConfigName;
for (bool bRet = xNameList.First(strConfigName); bRet; bRet = xNameList.Next(strConfigName))
{
const int nServerType = m_pElementInfoModule->GetPropertyInt(strConfigName, "Type");
const int nServerID = m_pElementInfoModule->GetPropertyInt(strConfigName, "ServerID");
if (nServerType == NF_SERVER_TYPES::NF_ST_GAME && pPluginManager->AppID() == nServerID)
{
const int nPort = m_pElementInfoModule->GetPropertyInt(strConfigName, "Port");
const int nMaxConnect = m_pElementInfoModule->GetPropertyInt(strConfigName, "MaxOnline");
const int nCpus = m_pElementInfoModule->GetPropertyInt(strConfigName, "CpuCount");
const std::string& strName = m_pElementInfoModule->GetPropertyString(strConfigName, "Name");
const std::string& strIP = m_pElementInfoModule->GetPropertyString(strConfigName, "IP");
NFMsg::ServerInfoReportList xMsg;
NFMsg::ServerInfoReport* pData = xMsg.add_server_list();
pData->set_server_id(nServerID);
pData->set_server_name(strName);
pData->set_server_cur_count(0);
pData->set_server_ip(strIP);
pData->set_server_port(nPort);
pData->set_server_max_online(nMaxConnect);
pData->set_server_state(NFMsg::EST_NARMAL);
pData->set_server_type(nServerType);
NF_SHARE_PTR<ServerData> pServerData = GetServerNetInfo(pNet);
if (pServerData)
{
int nTargetID = pServerData->nGameID;
SendToServerByPB(nTargetID, NFMsg::EGameMsgID::EGMI_GTW_GAME_REGISTERED, xMsg);
m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFIDENTID(0, pData->server_id()), pData->server_name(), "Register");
}
}
}
}
}
示例6: Register
void NFCProxyServerToWorldModule::Register(NFINet* pNet)
{
NF_SHARE_PTR<NFIClass> xLogicClass = m_pClassModule->GetElement(NFrame::Server::ThisName());
if (xLogicClass)
{
const std::vector<std::string>& strIdList = xLogicClass->GetIDList();
for (int i = 0; i < strIdList.size(); ++i)
{
const std::string& strId = strIdList[i];
const int nServerType = m_pElementModule->GetPropertyInt32(strId, NFrame::Server::Type());
const int nServerID = m_pElementModule->GetPropertyInt32(strId, NFrame::Server::ServerID());
if (nServerType == NF_SERVER_TYPES::NF_ST_PROXY && pPluginManager->GetAppID() == nServerID)
{
const int nPort = m_pElementModule->GetPropertyInt32(strId, NFrame::Server::Port());
const int nMaxConnect = m_pElementModule->GetPropertyInt32(strId, NFrame::Server::MaxOnline());
const int nCpus = m_pElementModule->GetPropertyInt32(strId, NFrame::Server::CpuCount());
const std::string& strName = m_pElementModule->GetPropertyString(strId, NFrame::Server::Name());
const std::string& strIP = m_pElementModule->GetPropertyString(strId, NFrame::Server::IP());
NFMsg::ServerInfoReportList xMsg;
NFMsg::ServerInfoReport* pData = xMsg.add_server_list();
pData->set_server_id(nServerID);
pData->set_server_name(strName);
pData->set_server_cur_count(0);
pData->set_server_ip(strIP);
pData->set_server_port(nPort);
pData->set_server_max_online(nMaxConnect);
pData->set_server_state(NFMsg::EST_NARMAL);
pData->set_server_type(nServerType);
NF_SHARE_PTR<ConnectData> pServerData = GetClusterModule()->GetServerNetInfo(pNet);
if (pServerData)
{
int nTargetID = pServerData->nGameID;
GetClusterModule()->SendToServerByPB(nTargetID, NFMsg::EGameMsgID::EGMI_PTWG_PROXY_REGISTERED, xMsg);
m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFGUID(0, pData->server_id()), pData->server_name(), "Register");
}
}
}
}
}
示例7: SynWorldToLogin
void NFCMasterNet_ServerModule::SynWorldToLogin()
{
NFMsg::ServerInfoReportList xData;
NF_SHARE_PTR<ServerData> pServerData = mWorldMap.First();
while (pServerData.get())
{
NFMsg::ServerInfoReport* pData = xData.add_server_list();
*pData = *(pServerData->pData);
pServerData = mWorldMap.Next();
}
//广播给所有loginserver
pServerData = mLoginMap.First();
while (pServerData.get())
{
m_pNetModule->SendMsgPB(NFMsg::EGameMsgID::EGMI_STS_NET_INFO, xData, pServerData->nFD);
pServerData = mLoginMap.Next();
}
}