summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-03-10 01:16:50 +0300
committerAndrei Karas <akaras@inbox.ru>2015-03-10 16:07:17 +0300
commit8aad60beb37fb0f364b0d8ab5bbe66232eacb676 (patch)
tree3a1680eadda26f9eca889d85420e73178be683d7
parent4ee5c0ce8a8ded1f4aa30212948c3acefb2b6242 (diff)
downloadmv-8aad60beb37fb0f364b0d8ab5bbe66232eacb676.tar.gz
mv-8aad60beb37fb0f364b0d8ab5bbe66232eacb676.tar.bz2
mv-8aad60beb37fb0f364b0d8ab5bbe66232eacb676.tar.xz
mv-8aad60beb37fb0f364b0d8ab5bbe66232eacb676.zip
Add UNIMPLIMENTEDPACKET macro
-rw-r--r--src/Makefile.am2
-rw-r--r--src/gui/windows/chatwindow.cpp1
-rw-r--r--src/logger.cpp11
-rw-r--r--src/logger.h5
4 files changed, 18 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 86e1355da..076ce7b80 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -51,6 +51,8 @@ dyecmd_SOURCES = gui/cliprect.cpp \
navigationmanager.h \
settings.cpp \
settings.h \
+ listeners/debugmessagelistener.cpp \
+ listeners/debugmessagelistener.h \
resources/map/walklayer.cpp \
resources/map/walklayer.h \
render/graphics.cpp \
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index dd1c4d5f7..b1c0f6982 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -2128,7 +2128,6 @@ bool ChatWindow::isTabPresent(const ChatTab *const tab) const
void ChatWindow::debugMessage(const std::string &msg)
{
- logger->log(msg);
if (debugChatTab)
debugChatTab->chatLog(msg, ChatMsgType::BY_SERVER);
}
diff --git a/src/logger.cpp b/src/logger.cpp
index 8417a3c83..e5b7264cf 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -24,6 +24,10 @@
#include "settings.h"
+#include "listeners/debugmessagelistener.h"
+
+#include "utils/stringutils.h"
+
#include <iostream>
#include <sstream>
@@ -351,3 +355,10 @@ void Logger::error(const std::string &error_text)
#endif
exit(1);
}
+
+void Logger::unimplimented(const int id)
+{
+ 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 5a44c959a..4ddf28818 100644
--- a/src/logger.h
+++ b/src/logger.h
@@ -46,6 +46,9 @@
#define IGNOREDEBUGLOG {}
#endif
+#define UNIMPLIMENTEDPACKET \
+ logger->unimplimented(msg.getId())
+
/**
* The Log Class : Useful to write debug or info messages
*/
@@ -140,6 +143,8 @@ class Logger final
void safeError(const std::string &error_text)
__attribute__ ((noreturn));
+ void unimplimented(const int id);
+
private:
std::ofstream mLogFile;
std::vector<std::string> mDelayedLog;