|
22 | 22 | #include "CHTTPD.h" |
23 | 23 | #include "CStaticFunctionDefinitions.h" |
24 | 24 |
|
25 | | -#define MTA_SERVER_CONF_TEMPLATE "mtaserver.conf.template" |
26 | | - |
27 | 25 | extern CGame* g_pGame; |
28 | 26 |
|
29 | 27 | CBandwidthSettings* g_pBandwidthSettings = new CBandwidthSettings(); |
@@ -116,11 +114,6 @@ bool CMainConfig::Load() |
116 | 114 | return false; |
117 | 115 | } |
118 | 116 |
|
119 | | - if (AddMissingSettings()) |
120 | | - { |
121 | | - Save(); |
122 | | - } |
123 | | - |
124 | 117 | // Name |
125 | 118 | int iResult = GetString(m_pRootNode, "servername", m_strServerName, 1, 96); |
126 | 119 | if (iResult == DOESNT_EXIST) |
@@ -843,56 +836,6 @@ bool CMainConfig::Save() |
843 | 836 | return false; |
844 | 837 | } |
845 | 838 |
|
846 | | -// |
847 | | -// Compare against default config and add missing nodes. |
848 | | -// Returns true if nodes were added. |
849 | | -// |
850 | | -bool CMainConfig::AddMissingSettings() |
851 | | -{ |
852 | | - // Only mtaserver.conf is currently supported |
853 | | - if (!g_pGame->IsUsingMtaServerConf()) |
854 | | - return false; |
855 | | - |
856 | | - SString strTemplateFilename = PathJoin(g_pServerInterface->GetServerModPath(), "mtaserver.conf.template"); |
857 | | - |
858 | | - if (!FileExists(strTemplateFilename)) |
859 | | - return false; |
860 | | - |
861 | | - CXMLFile* pFileTemplate = g_pServerInterface->GetXML()->CreateXML(strTemplateFilename); |
862 | | - CXMLNode* pRootNodeTemplate = pFileTemplate && pFileTemplate->Parse() ? pFileTemplate->GetRootNode() : nullptr; |
863 | | - if (!pRootNodeTemplate) |
864 | | - { |
865 | | - CLogger::ErrorPrintf("Can't parse '%s'\n", *strTemplateFilename); |
866 | | - return false; |
867 | | - } |
868 | | - |
869 | | - // Check that each item in the template also exists in the server config |
870 | | - bool bChanged = false; |
871 | | - CXMLNode* pPrevNode = nullptr; |
872 | | - for (auto it = pRootNodeTemplate->ChildrenBegin(); it != pRootNodeTemplate->ChildrenEnd(); ++it) |
873 | | - { |
874 | | - CXMLNode* pNodeTemplate = *it; |
875 | | - SString strNodeName = pNodeTemplate->GetTagName(); |
876 | | - CXMLNode* pNode = m_pRootNode->FindSubNode(strNodeName); |
877 | | - if (!pNode) |
878 | | - { |
879 | | - CLogger::LogPrintf("Adding missing '%s' to mtaserver.conf\n", *strNodeName); |
880 | | - SString strNodeValue = pNodeTemplate->GetTagContent(); |
881 | | - SString strNodeComment = pNodeTemplate->GetCommentText(); |
882 | | - pNode = m_pRootNode->CreateSubNode(strNodeName, pPrevNode); |
883 | | - pNode->SetTagContent(strNodeValue); |
884 | | - pNode->SetCommentText(strNodeComment, true); |
885 | | - bChanged = true; |
886 | | - } |
887 | | - pPrevNode = pNode; |
888 | | - } |
889 | | - |
890 | | - // Clean up |
891 | | - g_pServerInterface->GetXML()->DeleteXML(pFileTemplate); |
892 | | - FileDelete(strTemplateFilename); |
893 | | - return bChanged; |
894 | | -} |
895 | | - |
896 | 839 | bool CMainConfig::IsValidPassword(const char* szPassword) |
897 | 840 | { |
898 | 841 | if (!szPassword) |
|
0 commit comments