summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-03-10 17:58:46 +0300
committerAndrei Karas <akaras@inbox.ru>2015-03-10 17:58:46 +0300
commit4ed8030f36a873fdf881f37c6dccbf28029ce22a (patch)
tree935e9b16380da7c781e642e7efb5682128a67887
parent7d162145958fccfcc3ba32a7db3b8161cfe83fe2 (diff)
downloadplus-4ed8030f36a873fdf881f37c6dccbf28029ce22a.tar.gz
plus-4ed8030f36a873fdf881f37c6dccbf28029ce22a.tar.bz2
plus-4ed8030f36a873fdf881f37c6dccbf28029ce22a.tar.xz
plus-4ed8030f36a873fdf881f37c6dccbf28029ce22a.zip
Add option in settings to enable/disable logging unimplimented packets.
-rw-r--r--src/client.cpp1
-rw-r--r--src/defaults.cpp1
-rw-r--r--src/gui/widgets/tabs/setup_other.cpp5
-rw-r--r--src/logger.cpp6
-rw-r--r--src/logger.h4
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;