From 8e4f4e04ca61594e3dec31bad70eaf6cdf86ad8f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 14 Jan 2014 00:56:03 +0300 Subject: add support for thread safe writing to log. --- src/gui/gui.cpp | 10 ++++++++++ src/gui/gui.h | 1 + 2 files changed, 11 insertions(+) (limited to 'src/gui') diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index f84750e17..8dbaec952 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -49,6 +49,7 @@ #include "resources/resourcemanager.h" #include "utils/langs.h" +#include "utils/timer.h" #include @@ -107,6 +108,7 @@ Gui::Gui() : mFocusListeners(), mForegroundColor(Theme::getThemeColor(Theme::TEXT)), mForegroundColor2(Theme::getThemeColor(Theme::TEXT_OUTLINE)), + mTime(0), mCustomCursor(false), mDoubleClick(true) { @@ -366,6 +368,14 @@ void Gui::slowLogic() mNpcFont->slowLogic(5); if (windowContainer) windowContainer->slowLogic(); + + const int time = cur_time; + if (mTime != time) + { + logger->flush(); + mTime = time; + } + BLOCK_END("Gui::slowLogic") } diff --git a/src/gui/gui.h b/src/gui/gui.h index 56895b699..7c34fc5cf 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -197,6 +197,7 @@ class Gui final : public gcn::Gui FocusListenerList mFocusListeners; gcn::Color mForegroundColor; gcn::Color mForegroundColor2; + int mTime; bool mCustomCursor; /**< Show custom cursor */ bool mDoubleClick; }; -- cgit v1.2.3-70-g09d2