diff --git a/NFServer/NFAIServerNet_ClientPlugin/NFCAIServerToWorldModule.cpp b/NFServer/NFAIServerNet_ClientPlugin/NFCAIServerToWorldModule.cpp index cd3a27b0d7..20cfd2db59 100644 --- a/NFServer/NFAIServerNet_ClientPlugin/NFCAIServerToWorldModule.cpp +++ b/NFServer/NFAIServerNet_ClientPlugin/NFCAIServerToWorldModule.cpp @@ -160,13 +160,33 @@ bool NFCAIServerToWorldModule::AfterInit() if (xLogicClass) { const std::vector& strIdList = xLogicClass->GetIDList(); + + const int nCurAppID = pPluginManager->GetAppID(); + std::vector::const_iterator itr = + std::find_if(strIdList.begin(), strIdList.end(), [&](const std::string& strConfigId) + { + return nCurAppID == m_pElementModule->GetPropertyInt(strConfigId, NFrame::Server::ServerID()); + }); + + if (strIdList.end() == itr) + { + std::ostringstream strLog; + strLog << "Cannot find current server, AppID = " << nCurAppID; + m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, NULL_OBJECT, strLog, __FUNCTION__, __LINE__); + NFASSERT(-1, "Cannot find current server", __FILE__, __FUNCTION__); + exit(0); + } + + const int nCurArea = m_pElementModule->GetPropertyInt(*itr, NFrame::Server::Area()); + for (int i = 0; i < strIdList.size(); ++i) { const std::string& strId = strIdList[i]; 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) + const int nServerArea = m_pElementModule->GetPropertyInt(strId, NFrame::Server::Area()); + if (nServerType == NF_SERVER_TYPES::NF_ST_WORLD && nCurArea == nServerArea) { const int nPort = m_pElementModule->GetPropertyInt(strId, NFrame::Server::Port()); const int nMaxConnect = m_pElementModule->GetPropertyInt(strId, NFrame::Server::MaxOnline()); diff --git a/NFServer/NFGameServerNet_ClientPlugin/NFCGameServerToWorldModule.cpp b/NFServer/NFGameServerNet_ClientPlugin/NFCGameServerToWorldModule.cpp index e3733698e7..6cdfa10860 100644 --- a/NFServer/NFGameServerNet_ClientPlugin/NFCGameServerToWorldModule.cpp +++ b/NFServer/NFGameServerNet_ClientPlugin/NFCGameServerToWorldModule.cpp @@ -174,7 +174,7 @@ bool NFCGameServerToWorldModule::AfterInit() std::ostringstream strLog; strLog << "Cannot find current server, AppID = " << nCurAppID; m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, NULL_OBJECT, strLog, __FUNCTION__, __LINE__); - NFASSERT(0, "Cannot find current server", __FILE__, __FUNCTION__); + NFASSERT(-1, "Cannot find current server", __FILE__, __FUNCTION__); exit(0); } diff --git a/NFServer/NFProxyServerNet_ClientPlugin/NFCProxyServerToWorldModule.cpp b/NFServer/NFProxyServerNet_ClientPlugin/NFCProxyServerToWorldModule.cpp index 3d8f2362a8..7e60ad07fe 100644 --- a/NFServer/NFProxyServerNet_ClientPlugin/NFCProxyServerToWorldModule.cpp +++ b/NFServer/NFProxyServerNet_ClientPlugin/NFCProxyServerToWorldModule.cpp @@ -203,14 +203,34 @@ bool NFCProxyServerToWorldModule::AfterInit() NF_SHARE_PTR xLogicClass = m_pClassModule->GetElement(NFrame::Server::ThisName()); if (xLogicClass) { - const std::vector& strIdList = xLogicClass->GetIDList(); + const std::vector& strIdList = xLogicClass->GetIDList(); + + const int nCurAppID = pPluginManager->GetAppID(); + std::vector::const_iterator itr = + std::find_if(strIdList.begin(), strIdList.end(), [&](const std::string& strConfigId) + { + return nCurAppID == m_pElementModule->GetPropertyInt(strConfigId, NFrame::Server::ServerID()); + }); + + if (strIdList.end() == itr) + { + std::ostringstream strLog; + strLog << "Cannot find current server, AppID = " << nCurAppID; + m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, NULL_OBJECT, strLog, __FUNCTION__, __LINE__); + NFASSERT(-1, "Cannot find current server", __FILE__, __FUNCTION__); + exit(0); + } + + const int nCurArea = m_pElementModule->GetPropertyInt(*itr, NFrame::Server::Area()); + for (int i = 0; i < strIdList.size(); ++i) { const std::string& strId = strIdList[i]; 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) + const int nServerArea = m_pElementModule->GetPropertyInt(strId, NFrame::Server::Area()); + if (nServerType == NF_SERVER_TYPES::NF_ST_WORLD && nCurArea == nServerArea) { const int nPort = m_pElementModule->GetPropertyInt(strId, NFrame::Server::Port()); const int nMaxConnect = m_pElementModule->GetPropertyInt(strId, NFrame::Server::MaxOnline());