From 1fb4ed8eef558d13ef6f72253652ce65611e0c4b Mon Sep 17 00:00:00 2001 From: glx22 Date: Thu, 7 Jan 2021 00:53:10 +0100 Subject: Fix: Use realtime for error message and console backlog timeouts --- src/console_gui.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/console_gui.cpp') diff --git a/src/console_gui.cpp b/src/console_gui.cpp index c8ad5fbdb..731073866 100644 --- a/src/console_gui.cpp +++ b/src/console_gui.cpp @@ -12,6 +12,7 @@ #include "window_gui.h" #include "console_gui.h" #include "console_internal.h" +#include "guitimer_func.h" #include "window_func.h" #include "string_func.h" #include "strings_func.h" @@ -171,6 +172,7 @@ struct IConsoleWindow : Window static int scroll; int line_height; ///< Height of one line of text in the console. int line_offset; + GUITimer truncate_timer; IConsoleWindow() : Window(&_console_window_desc) { @@ -179,6 +181,7 @@ struct IConsoleWindow : Window this->line_offset = GetStringBoundingBox("] ").width + 5; this->InitNested(0); + this->truncate_timer.SetInterval(3000); ResizeWindow(this, _screen.width, _screen.height / 3); } @@ -227,8 +230,10 @@ struct IConsoleWindow : Window } } - void OnHundredthTick() override + void OnRealtimeTick(uint delta_ms) override { + if (this->truncate_timer.CountElapsed(delta_ms) == 0) return; + if (IConsoleLine::Truncate() && (IConsoleWindow::scroll > IConsoleLine::size)) { IConsoleWindow::scroll = std::max(0, IConsoleLine::size - (this->height / this->line_height) + 1); -- cgit v1.2.3-54-g00ecf