diff options
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/src/client.cpp b/src/client.cpp index aa48591f..323d5b49 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -22,6 +22,7 @@ #include "client.h" #include "main.h" +#include "chatlog.h" #include "configuration.h" #include "emoteshortcut.h" #include "game.h" @@ -110,6 +111,7 @@ LoginData loginData; Configuration config; /**< XML file configuration reader */ Configuration branding; /**< XML branding information reader */ Logger *logger; /**< Log object */ +ChatLogger *chatLogger; /**< Chat log object */ KeyboardConfig keyboard; UserPalette *userPalette; @@ -219,6 +221,12 @@ Client::Client(const Options &options): initHomeDir(); initConfiguration(); + chatLogger = new ChatLogger; + if (options.chatLogDir == "") + chatLogger->setLogDir(mLocalDataDir + std::string("/logs/")); + else + chatLogger->setLogDir(options.chatLogDir); + // Configure logger logger->setLogFile(mLocalDataDir + std::string("/mana.log")); logger->setLogToStandardOut(config.getValue("logToStandardOut", 0)); @@ -400,6 +408,9 @@ Client::Client(const Options &options): branding.getValue("defaultServerType", "tmwathena")); } + if (chatLogger) + chatLogger->setServerName(mCurrentServer.hostname); + if (loginData.username.empty() && loginData.remember) loginData.username = config.getValue("username", ""); @@ -576,13 +587,18 @@ int Client::exec() delete game; game = 0; - // Unload XML databases - ColorDB::unload(); - EmoteDB::unload(); - ItemDB::unload(); - MonsterDB::unload(); - NPCDB::unload(); - StatusEffect::unload(); + if (mState != STATE_CHANGE_MAP) + { + // Unload XML databases + ColorDB::unload(); + EmoteDB::unload(); + ItemDB::unload(); + MonsterDB::unload(); + NPCDB::unload(); + StatusEffect::unload(); + + ActorSprite::unload(); + } } mOldState = mState; @@ -737,6 +753,8 @@ int Client::exec() StatusEffect::load(); Units::loadUnits(); + ActorSprite::load(); + mDesktop->reloadWallpaper(); mState = STATE_GET_CHARACTERS; @@ -1142,7 +1160,7 @@ void Client::initUpdatesDir() } // Remove any trailing slash at the end of the update host - if (mUpdateHost.at(mUpdateHost.size() - 1) == '/') + if (!mUpdateHost.empty() && mUpdateHost.at(mUpdateHost.size() - 1) == '/') mUpdateHost.resize(mUpdateHost.size() - 1); // Parse out any "http://" or "ftp://", and set the updates directory @@ -1150,7 +1168,7 @@ void Client::initUpdatesDir() pos = mUpdateHost.find("://"); if (pos != mUpdateHost.npos) { - if (pos + 3 < mUpdateHost.length()) + if (pos + 3 < mUpdateHost.length() && !mUpdateHost.empty()) { updates << "updates/" << mUpdateHost.substr(pos + 3); mUpdatesDir = updates.str(); |