From fb38a2ef46b194e1aaefbfd9c76788ecfecde2dc Mon Sep 17 00:00:00 2001 From: dP Date: Mon, 16 Jun 2025 12:51:47 +0500 Subject: [PATCH] Fix minimap industry blinking rate --- src/citymania/cm_minimap.cpp | 25 +------------------------ src/citymania/cm_minimap.hpp | 3 +-- src/smallmap_gui.cpp | 2 +- src/timer/timer_window.h | 3 +++ 4 files changed, 6 insertions(+), 27 deletions(-) diff --git a/src/citymania/cm_minimap.cpp b/src/citymania/cm_minimap.cpp index 3fb9af5ed6..a2ea68e338 100644 --- a/src/citymania/cm_minimap.cpp +++ b/src/citymania/cm_minimap.cpp @@ -1761,30 +1761,6 @@ int SmallMapWindow::GetPositionOnLegend(Point pt) } } -/* virtual */ void SmallMapWindow::OnRealtimeTick(uint /* delta_ms */) -{ - /* Update the window every now and then */ - if (this->map_type == SMT_LINKSTATS) { - uint32 company_mask = this->GetOverlayCompanyMask(); - if (this->overlay->GetCompanyMask() != company_mask) { - this->overlay->SetCompanyMask(company_mask); - } else { - this->overlay->SetDirty(); - } - } - _smallmap_industry_highlight_state = !_smallmap_industry_highlight_state; - - this->SetDirty(); -} - -// /* virtual */ void SmallMapWindow::OnHundredthTick() -// { -// if (this->show_towns) { -// this->UpdateTownCache(true); -// this->SetDirty(); -// } -// } - /** Update all the links on the map. */ void SmallMapWindow::UpdateLinks() { @@ -1814,6 +1790,7 @@ void SmallMapWindow::ForceRefresh() { if (_smallmap_industry_highlight != INVALID_INDUSTRYTYPE) return; + if (this->show_towns) this->UpdateTownCache(true); this->UpdateLinks(); this->SetDirty(); } diff --git a/src/citymania/cm_minimap.hpp b/src/citymania/cm_minimap.hpp index 6ec3ecbf11..c133adb885 100644 --- a/src/citymania/cm_minimap.hpp +++ b/src/citymania/cm_minimap.hpp @@ -192,7 +192,7 @@ protected: } /** Blink the industries (if selected) on a regular interval. */ - IntervalTimer blink_interval = {std::chrono::milliseconds(450), [this](auto) { + IntervalTimer blink_interval = {TIMER_BLINK_INTERVAL, [this](auto) { Blink(); }}; @@ -245,7 +245,6 @@ public: void OnInvalidateData(int data = 0, bool gui_scope = true) override; bool OnRightClick(Point pt, int widget) override; void OnMouseWheel(int wheel) override; - void OnRealtimeTick(uint delta_ms) override; // void OnHundredthTick() override; void OnScroll(Point delta) override; void OnMouseOver(Point pt, int widget) override; diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index bb53729077..e321e0efee 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -772,7 +772,7 @@ protected: } /** Blink the industries (if selected) on a regular interval. */ - IntervalTimer blink_interval = {std::chrono::milliseconds(450), [this](auto) { + 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 */