Skip to content

Commit 525f43d

Browse files
remove mtaserver.conf.template
1 parent 750d09a commit 525f43d

File tree

4 files changed

+1
-354
lines changed

4 files changed

+1
-354
lines changed

Server/mods/deathmatch/logic/CMainConfig.cpp

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
#include "CHTTPD.h"
2323
#include "CStaticFunctionDefinitions.h"
2424

25-
#define MTA_SERVER_CONF_TEMPLATE "mtaserver.conf.template"
26-
2725
extern CGame* g_pGame;
2826

2927
CBandwidthSettings* g_pBandwidthSettings = new CBandwidthSettings();
@@ -116,11 +114,6 @@ bool CMainConfig::Load()
116114
return false;
117115
}
118116

119-
if (AddMissingSettings())
120-
{
121-
Save();
122-
}
123-
124117
// Name
125118
int iResult = GetString(m_pRootNode, "servername", m_strServerName, 1, 96);
126119
if (iResult == DOESNT_EXIST)
@@ -843,56 +836,6 @@ bool CMainConfig::Save()
843836
return false;
844837
}
845838

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-
896839
bool CMainConfig::IsValidPassword(const char* szPassword)
897840
{
898841
if (!szPassword)

Server/mods/deathmatch/logic/CMainConfig.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ class CMainConfig : public CXMLConfig
152152
private:
153153
void RegisterCommand(const char* szName, FCommandHandler* pFunction, bool bRestricted, const char* szConsoleHelpText);
154154
bool GetSettingTable(const SString& strName, const char** szAttribNames, uint uiNumAttribNames, CLuaArguments* outTable);
155-
bool AddMissingSettings();
156155

157156
CConsole* m_pConsole;
158157
CXMLNode* m_pRootNode;

0 commit comments

Comments
 (0)