From 654285675ececa142877d86e6f730d040625fc6e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 16 Jun 2011 01:39:44 +0300 Subject: Add dataPath to branding. --- src/client.cpp | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'src/client.cpp') diff --git a/src/client.cpp b/src/client.cpp index bba55a960..be3d20373 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -257,16 +257,16 @@ Client::Client(const Options &options): logger = new Logger; // Load branding information - if (!options.brandingPath.empty()) - branding.init(options.brandingPath); + if (!mOptions.brandingPath.empty()) + branding.init(mOptions.brandingPath); branding.setDefaultValues(getBrandingDefaults()); initRootDir(); initHomeDir(); // Configure logger - if (!options.logFileName.empty()) - logger->setLogFile(options.logFileName); + if (!mOptions.logFileName.empty()) + logger->setLogFile(mOptions.logFileName); else logger->setLogFile(mLocalDataDir + std::string("/manaplus.log")); @@ -276,10 +276,10 @@ Client::Client(const Options &options): storeSafeParameters(); chatLogger = new ChatLogger; - if (options.chatLogDir == "") + if (mOptions.chatLogDir == "") chatLogger->setLogDir(mLocalDataDir + std::string("/logs/")); else - chatLogger->setLogDir(options.chatLogDir); + chatLogger->setLogDir(mOptions.chatLogDir); logger->setLogToStandardOut(config.getBoolValue("logToStandardOut")); @@ -344,9 +344,9 @@ Client::Client(const Options &options): resman->addToSearchPath("data", false); // Add branding/data to PhysFS search path - if (!options.brandingPath.empty()) + if (!mOptions.brandingPath.empty()) { - std::string path = options.brandingPath; + std::string path = mOptions.brandingPath; // Strip blah.mana from the path #ifdef WIN32 @@ -360,9 +360,17 @@ Client::Client(const Options &options): resman->addToSearchPath(path.substr(0, loc + 1) + "data", false); } + if (mOptions.dataPath.empty() + && !branding.getStringValue("dataPath").empty()) + { + mOptions.dataPath = branding.getDirectory() + "/" + + branding.getStringValue("dataPath"); + mOptions.skipUpdate = true; + } + // Add the main data directories to our PhysicsFS search path - if (!options.dataPath.empty()) - resman->addToSearchPath(options.dataPath, false); + if (!mOptions.dataPath.empty()) + resman->addToSearchPath(mOptions.dataPath, false); // Add the local data directory to PhysicsFS search path resman->addToSearchPath(mLocalDataDir, false); @@ -489,11 +497,11 @@ Client::Client(const Options &options): sound.playMusic(branding.getValue("loginMusic", "Magick - Real.ogg")); // Initialize default server - mCurrentServer.hostname = options.serverName; - mCurrentServer.port = options.serverPort; + mCurrentServer.hostname = mOptions.serverName; + mCurrentServer.port = mOptions.serverPort; - loginData.username = options.username; - loginData.password = options.password; + loginData.username = mOptions.username; + loginData.password = mOptions.password; loginData.remember = serverConfig.getValue("remember", 0); loginData.registerLogin = false; -- cgit v1.2.3-60-g2f50