From 0ca0a5277ebd8b759367705457fb4dd018759263 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 29 May 2014 13:31:44 +0300 Subject: Move some other vars from client into settings. --- src/client.cpp | 23 +++++++++++------------ src/client.h | 4 ---- src/settings.h | 4 ++++ 3 files changed, 15 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/client.cpp b/src/client.cpp index 868d40454..454573ac6 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -209,7 +209,6 @@ namespace Client::Client() : ActionListener(), - mRootDir(), mCurrentServer(), mGame(nullptr), mCurrentDialog(nullptr), @@ -227,7 +226,6 @@ Client::Client() : mState(STATE_CHOOSE_SERVER), mOldState(STATE_START), mIcon(nullptr), - mCaption(), mFpsManager(), mSkin(nullptr), mGuiAlpha(1.0F), @@ -574,19 +572,19 @@ void Client::initTitle() { if (settings.options.test.empty()) { - mCaption = strprintf("%s %s", + settings.windowCaption = strprintf("%s %s", branding.getStringValue("appName").c_str(), SMALL_VERSION); } else { - mCaption = strprintf( + settings.windowCaption = strprintf( "Please wait - VIDEO MODE TEST - %s %s - Please wait", branding.getStringValue("appName").c_str(), SMALL_VERSION); } - SDL::SetWindowTitle(mainGraphics->getWindow(), mCaption.c_str()); + SDL::SetWindowTitle(mainGraphics->getWindow(), settings.windowCaption.c_str()); #ifndef WIN32 setIcon(); #endif @@ -1878,8 +1876,8 @@ void Client::action(const ActionEvent &event) void Client::initRootDir() { - mRootDir = PhysFs::getBaseDir(); - const std::string portableName = mRootDir + "portable.xml"; + settings.rootDir = PhysFs::getBaseDir(); + const std::string portableName = settings.rootDir + "portable.xml"; struct stat statbuf; if (!stat(portableName.c_str(), &statbuf) && S_ISREG(statbuf.st_mode)) @@ -1901,7 +1899,7 @@ void Client::initRootDir() dir = portable.getValue("dataDir", ""); if (!dir.empty()) { - settings.options.localDataDir = mRootDir + dir; + settings.options.localDataDir = settings.rootDir + dir; logger->log("Portable data dir: %s", settings.options.localDataDir.c_str()); } @@ -1912,7 +1910,7 @@ void Client::initRootDir() dir = portable.getValue("configDir", ""); if (!dir.empty()) { - settings.options.configDir = mRootDir + dir; + settings.options.configDir = settings.rootDir + dir; logger->log("Portable config dir: %s", settings.options.configDir.c_str()); } @@ -1923,7 +1921,7 @@ void Client::initRootDir() dir = portable.getValue("screenshotDir", ""); if (!dir.empty()) { - settings.options.screenshotDir = mRootDir + dir; + settings.options.screenshotDir = settings.rootDir + dir; logger->log("Portable screenshot dir: %s", settings.options.screenshotDir.c_str()); } @@ -2863,7 +2861,8 @@ void Client::setIsMinimized(const bool n) if (!n && mNewMessageFlag) { mNewMessageFlag = false; - SDL::SetWindowTitle(mainGraphics->getWindow(), mCaption.c_str()); + SDL::SetWindowTitle(mainGraphics->getWindow(), + settings.windowCaption.c_str()); } } @@ -2873,7 +2872,7 @@ void Client::newChatMessage() { // show * on window caption SDL::SetWindowTitle(mainGraphics->getWindow(), - ("*" + client->mCaption).c_str()); + ("*" + settings.windowCaption).c_str()); mNewMessageFlag = true; } } diff --git a/src/client.h b/src/client.h index e2e5a84de..7fb34b98e 100644 --- a/src/client.h +++ b/src/client.h @@ -256,9 +256,6 @@ private: #endif #endif - std::string mRootDir; - std::string mLogFileName; - ServerInfo mCurrentServer; Game *mGame; @@ -280,7 +277,6 @@ private: SDL_Surface *mIcon; - std::string mCaption; FPSmanager mFpsManager; Skin *mSkin; float mGuiAlpha; diff --git a/src/settings.h b/src/settings.h index f88ccb257..78f86a59f 100644 --- a/src/settings.h +++ b/src/settings.h @@ -46,6 +46,8 @@ class Settings final npcsDir(), supportUrl(), logFileName(), + rootDir(), + windowCaption(), updateMirrors(), options(), persistentIp(true) @@ -65,6 +67,8 @@ class Settings final std::string npcsDir; std::string supportUrl; std::string logFileName; + std::string rootDir; + std::string windowCaption; std::vector updateMirrors; Options options; bool persistentIp; -- cgit v1.2.3-60-g2f50