summaryrefslogtreecommitdiff
path: root/src/configmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/configmanager.cpp')
-rw-r--r--src/configmanager.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/configmanager.cpp b/src/configmanager.cpp
index b412d1044..94175341c 100644
--- a/src/configmanager.cpp
+++ b/src/configmanager.cpp
@@ -39,6 +39,14 @@
#include "debug.h"
+static void setDefaultOption(const char *const name,
+ const bool def)
+{
+ int val = serverConfig.getValue(name, -1);
+ if (val == -1)
+ serverConfig.setValue(name, def);
+}
+
/**
* Initializes the home directory. On UNIX and FreeBSD, ~/.mana is used. On
* Windows and other systems we use the current working directory.
@@ -68,15 +76,9 @@ void ConfigManager::initServerConfig(const std::string &serverName)
logger->log("serverConfigPath: " + configPath);
}
- int val = serverConfig.getValue("enableManaMarketBot", -1);
- if (val == -1)
- {
- if (client->isTmw())
- val = 1;
- else
- val = 0;
- serverConfig.setValue("enableManaMarketBot", val);
- }
+ const bool val = client->isTmw();
+ setDefaultOption("enableManaMarketBot", val);
+ setDefaultOption("enableRemoteCommands", !val);
}
void ConfigManager::initConfiguration()