From 10841ea3fdc2dd1c90ee23d1ee53e116da5258f7 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Mon, 2 Jun 2025 19:13:29 +0100 Subject: [PATCH] Codechange: Add constant for common blink interval. --- src/smallmap_gui.cpp | 2 +- src/timer/timer_window.h | 3 +++ src/window.cpp | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index 954348c7c7..3282c907e8 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -730,7 +730,7 @@ protected: } /** Blink the industries (if selected) on a regular interval. */ - const IntervalTimer blink_interval = {std::chrono::milliseconds(450), [this](auto) { + const IntervalTimer blink_interval = {TIMER_BLINK_INTERVAL, [this](auto) { Blink(); }}; diff --git a/src/timer/timer_window.h b/src/timer/timer_window.h index b32048b4c4..789d82618b 100644 --- a/src/timer/timer_window.h +++ b/src/timer/timer_window.h @@ -32,4 +32,7 @@ public: }; }; +/** Interval used by blinking interface elements. */ +static constexpr std::chrono::milliseconds TIMER_BLINK_INTERVAL{450}; + #endif /* TIMER_WINDOW_H */ diff --git a/src/window.cpp b/src/window.cpp index bbe18a573e..6ae18eda28 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -3073,7 +3073,7 @@ static const IntervalTimer window_interval(std::chrono::millisecond }); /** Blink the window highlight colour constantly. */ -static const IntervalTimer highlight_interval(std::chrono::milliseconds(450), [](auto) { +static const IntervalTimer highlight_interval(TIMER_BLINK_INTERVAL, [](auto) { _window_highlight_colour = !_window_highlight_colour; });