From ab3911ba9eb320b7845f95e294020de4758d3efa Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 27 Nov 2011 14:29:48 +0200 Subject: Print errors from local log to chat --- src/game.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index 1c555dbee..5bbd92d55 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -49,6 +49,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "main.h" // For g_settings #include "tooldef.h" #include "tile.h" // For TextureSource +#include "logoutputbuffer.h" /* Setting this to 1 enables a special camera mode that forces @@ -642,6 +643,9 @@ void the_game( // Create node definition manager IWritableNodeDefManager *nodedef = createNodeDefManager(); + // Add chat log output for errors to be shown in chat + LogOutputBuffer chat_log_error_buf(LMT_ERROR); + /* Create server. SharedPtr will delete it when it goes out of scope. @@ -2122,7 +2126,13 @@ void the_game( Get chat messages from client */ { - // Get new messages + // Get new messages from error log buffer + while(!chat_log_error_buf.empty()) + { + chat_lines.push_back(ChatLine(narrow_to_wide( + chat_log_error_buf.get()))); + } + // Get new messages from client std::wstring message; while(client.getChatMessage(message)) { -- cgit v1.2.3