From 8aad60beb37fb0f364b0d8ab5bbe66232eacb676 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 10 Mar 2015 01:16:50 +0300 Subject: Add UNIMPLIMENTEDPACKET macro --- src/Makefile.am | 2 ++ src/gui/windows/chatwindow.cpp | 1 - src/logger.cpp | 11 +++++++++++ src/logger.h | 5 +++++ 4 files changed, 18 insertions(+), 1 deletion(-) 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 #include @@ -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 mDelayedLog; -- cgit v1.2.3-60-g2f50