summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-05-12 23:19:23 +0300
committerAndrei Karas <akaras@inbox.ru>2013-05-12 23:19:23 +0300
commita18645643144058d67301435505a506e36e0aa6b (patch)
treeab7c333c3e2c2ffc7ee4ebfb98ae63f1edda13bd /src
parente82b08179b74bd8bf54157897ee06626422f72b8 (diff)
downloadmv-a18645643144058d67301435505a506e36e0aa6b.tar.gz
mv-a18645643144058d67301435505a506e36e0aa6b.tar.bz2
mv-a18645643144058d67301435505a506e36e0aa6b.tar.xz
mv-a18645643144058d67301435505a506e36e0aa6b.zip
add features configuration file to enable/disable features per server.
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp24
-rw-r--r--src/client.h2
-rw-r--r--src/configuration.h1
-rw-r--r--src/defaults.cpp10
-rw-r--r--src/defaults.h1
5 files changed, 25 insertions, 13 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 8dd2e663a..cb17f4919 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -143,12 +143,13 @@ std::string errorMessage;
ErrorListener errorListener;
LoginData loginData;
-Configuration config; /**< XML file configuration reader */
-Configuration serverConfig; /**< XML file server configuration reader */
-Configuration branding; /**< XML branding information reader */
-Configuration paths; /**< XML default paths information reader */
-Logger *logger = nullptr; /**< Log object */
-ChatLogger *chatLogger = nullptr; /**< Chat log object */
+Configuration config; // XML file configuration reader
+Configuration serverConfig; // XML file server configuration reader
+Configuration features; // XML file features
+Configuration branding; // XML branding information reader
+Configuration paths; // XML default paths information reader
+Logger *logger = nullptr; // Log object
+ChatLogger *chatLogger = nullptr; // Chat log object
KeyboardConfig keyboard;
UserPalette *userPalette = nullptr;
Graphics *mainGraphics = nullptr;
@@ -344,6 +345,7 @@ void Client::gameInit()
logger->setLogFile(mLocalDataDir + "/manaplus.log");
initConfiguration();
+ initFeatures();
logger->log("init 4");
logger->setDebugLog(config.getBoolValue("debugLog"));
@@ -1074,6 +1076,7 @@ int Client::gameExec()
{
mServerName = mCurrentServer.hostname;
initServerConfig(mCurrentServer.hostname);
+ initFeatures();
loginData.registerUrl = mCurrentServer.registerUrl;
if (!mCurrentServer.onlineListUrl.empty())
mOnlineListUrl = mCurrentServer.onlineListUrl;
@@ -2014,9 +2017,12 @@ void Client::initServerConfig(std::string serverName)
dropShortcut = new DropShortcut;
}
-/**
- * Initialize configuration.
- */
+void Client::initFeatures() const
+{
+ features.init("features.xml", true);
+ paths.setDefaultValues(getFeaturesDefaults());
+}
+
void Client::initConfiguration() const
{
#ifdef DEBUG_CONFIG
diff --git a/src/client.h b/src/client.h
index c321cd385..1f577a4da 100644
--- a/src/client.h
+++ b/src/client.h
@@ -359,6 +359,8 @@ private:
void initServerConfig(std::string serverName);
+ void initFeatures() const;
+
void accountLogin(LoginData *const data) const;
void storeSafeParameters() const;
diff --git a/src/configuration.h b/src/configuration.h
index 75257687b..cffbab84e 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -361,5 +361,6 @@ extern Configuration branding;
extern Configuration config;
extern Configuration serverConfig;
extern Configuration paths;
+extern Configuration features;
#endif
diff --git a/src/defaults.cpp b/src/defaults.cpp
index 92ef24627..c5fd20828 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -71,7 +71,6 @@ VariableData* createData(const bool defData)
DefaultsData* getConfigDefaults()
{
DefaultsData *const configData = new DefaultsData;
- // Init main config defaults
AddDEF("OverlayDetail", 2);
AddDEF("speechBubbleAlpha", 1.0f);
AddDEF("MostUsedServerName0", "server.themanaworld.org");
@@ -369,7 +368,6 @@ void getConfigDefaults2(DefaultsData *const configData)
DefaultsData* getBrandingDefaults()
{
DefaultsData *const configData = new DefaultsData;
- // Init config defaults
AddDEF("wallpapersPath", "");
AddDEF("wallpapersFile", "");
AddDEF("appName", "ManaPlus");
@@ -384,7 +382,6 @@ DefaultsData* getBrandingDefaults()
AddDEF("appShort", "mana");
AddDEF("defaultUpdateHost", "");
AddDEF("helpPath", "");
-// AddDEF("onlineServerList", "");
AddDEF("theme", "");
AddDEF("font", "fonts/dejavusans.ttf");
AddDEF("boldFont", "fonts/dejavusans-bold.ttf");
@@ -408,7 +405,6 @@ DefaultsData* getBrandingDefaults()
DefaultsData* getPathsDefaults()
{
DefaultsData *const configData = new DefaultsData;
- // Init paths.xml defaults
AddDEF("itemIcons", "graphics/items/");
AddDEF("unknownItemFile", "unknown-item.png");
AddDEF("sprites", "graphics/sprites/");
@@ -440,4 +436,10 @@ DefaultsData* getPathsDefaults()
return configData;
}
+DefaultsData* getFeaturesDefaults()
+{
+ DefaultsData *const configData = new DefaultsData;
+ AddDEF("languageTab", false);
+}
+
#undef AddDEF
diff --git a/src/defaults.h b/src/defaults.h
index 12a8873d8..4cfddf00f 100644
--- a/src/defaults.h
+++ b/src/defaults.h
@@ -41,5 +41,6 @@ DefaultsData* getConfigDefaults() A_WARN_UNUSED;
void getConfigDefaults2(DefaultsData *const configData);
DefaultsData* getBrandingDefaults() A_WARN_UNUSED;
DefaultsData* getPathsDefaults() A_WARN_UNUSED;
+DefaultsData* getFeaturesDefaults() A_WARN_UNUSED;
#endif