diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-04-21 15:49:23 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-04-21 15:49:23 +0300 |
commit | 84b7634a85d0474d83af7002ee7639cf421686bf (patch) | |
tree | c1d4bed2c70f26b19db7758ad23aa4ace9c3d6c7 /src/configmanager.cpp | |
parent | ff67cb1d126ac5b26907816ddd094c517ae5216d (diff) | |
download | plus-84b7634a85d0474d83af7002ee7639cf421686bf.tar.gz plus-84b7634a85d0474d83af7002ee7639cf421686bf.tar.bz2 plus-84b7634a85d0474d83af7002ee7639cf421686bf.tar.xz plus-84b7634a85d0474d83af7002ee7639cf421686bf.zip |
Add option for enable/disable remote commands.
In tmw remote commands disabled by default.
Diffstat (limited to 'src/configmanager.cpp')
-rw-r--r-- | src/configmanager.cpp | 20 |
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() |