diff options
author | glx22 <glx@openttd.org> | 2021-01-07 00:53:10 +0100 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-01-10 14:07:17 +0100 |
commit | 1fb4ed8eef558d13ef6f72253652ce65611e0c4b (patch) | |
tree | 3ffde98a9b1c38350dc57c37a656e253c64d69c7 /src/console_gui.cpp | |
parent | c0d7949d7c798285cc289bb9c76b4b155256456c (diff) | |
download | openttd-1fb4ed8eef558d13ef6f72253652ce65611e0c4b.tar.xz |
Fix: Use realtime for error message and console backlog timeouts
Diffstat (limited to 'src/console_gui.cpp')
-rw-r--r-- | src/console_gui.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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); |