diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-03-10 17:58:46 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-03-10 17:58:46 +0300 |
commit | 4ed8030f36a873fdf881f37c6dccbf28029ce22a (patch) | |
tree | 935e9b16380da7c781e642e7efb5682128a67887 | |
parent | 7d162145958fccfcc3ba32a7db3b8161cfe83fe2 (diff) | |
download | mv-4ed8030f36a873fdf881f37c6dccbf28029ce22a.tar.gz mv-4ed8030f36a873fdf881f37c6dccbf28029ce22a.tar.bz2 mv-4ed8030f36a873fdf881f37c6dccbf28029ce22a.tar.xz mv-4ed8030f36a873fdf881f37c6dccbf28029ce22a.zip |
Add option in settings to enable/disable logging unimplimented packets.
-rw-r--r-- | src/client.cpp | 1 | ||||
-rw-r--r-- | src/defaults.cpp | 1 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_other.cpp | 5 | ||||
-rw-r--r-- | src/logger.cpp | 6 | ||||
-rw-r--r-- | src/logger.h | 4 |
5 files changed, 16 insertions, 1 deletions
diff --git a/src/client.cpp b/src/client.cpp index 1af7d9041..0d44fcbff 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -268,6 +268,7 @@ void Client::gameInit() initFeatures(); logger->log("init 4"); logger->setDebugLog(config.getBoolValue("debugLog")); + logger->setReportUnimplimented(config.getBoolValue("unimplimentedLog")); config.incValue("runcount"); diff --git a/src/defaults.cpp b/src/defaults.cpp index 3d4668e32..82adc3b0c 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -216,6 +216,7 @@ DefaultsData* getConfigDefaults() AddDEF("errorsInDebug", true); AddDEF("tradebot", true); AddDEF("debugLog", false); + AddDEF("unimplimentedLog", false); AddDEF("drawHotKeys", true); AddDEF("serverAttack", true); AddDEF("autofixPos", false); diff --git a/src/gui/widgets/tabs/setup_other.cpp b/src/gui/widgets/tabs/setup_other.cpp index 16d467f77..a20d4472b 100644 --- a/src/gui/widgets/tabs/setup_other.cpp +++ b/src/gui/widgets/tabs/setup_other.cpp @@ -366,6 +366,10 @@ Setup_Other::Setup_Other(const Widget2 *const widget) : "ignorelogpackets", this, "ignorelogpacketsEvent"); // TRANSLATORS: settings option + new SetupItemCheckBox(_("Log unimplimented packets"), "", + "unimplimentedLog", this, "unimplimentedLogEvent"); + + // TRANSLATORS: settings option new SetupItemCheckBox(_("Enable OpenGL log"), "", "debugOpenGL", this, "debugOpenGLEvent"); @@ -425,6 +429,7 @@ void Setup_Other::apply() SetupTabScroll::apply(); logger->setDebugLog(config.getBoolValue("debugLog")); + logger->setReportUnimplimented(config.getBoolValue("unimplimentedLog")); Net::loadIgnorePackets(); } diff --git a/src/logger.cpp b/src/logger.cpp index e5b7264cf..e91480f7f 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -74,7 +74,8 @@ Logger::Logger() : mMutex(SDL_CreateMutex()), mThreadLocked(false), mLogToStandardOut(true), - mDebugLog(false) + mDebugLog(false), + mReportUnimplimented(false) { } @@ -358,6 +359,9 @@ void Logger::error(const std::string &error_text) void Logger::unimplimented(const int id) { + if (!mReportUnimplimented) + return; + const std::string str = strprintf("Unimplimented packet: %d", id); DebugMessageListener::distributeEvent(str); log(str); diff --git a/src/logger.h b/src/logger.h index 4ddf28818..9e82670ad 100644 --- a/src/logger.h +++ b/src/logger.h @@ -130,6 +130,9 @@ class Logger final void setDebugLog(const bool n) { mDebugLog = n; } + void setReportUnimplimented(const bool n) + { mReportUnimplimented = n; } + /** * Log an error and quit. The error will pop-up on Windows and Mac, and * will be printed to standard error everywhere else. @@ -152,6 +155,7 @@ class Logger final volatile bool mThreadLocked; bool mLogToStandardOut; bool mDebugLog; + bool mReportUnimplimented; }; extern Logger *logger; |