From 75197a11a850a8d0be3c39ec6573037d19dda671 Mon Sep 17 00:00:00 2001 From: mvglasow Date: Tue, 8 Jul 2025 22:50:54 +0300 Subject: [PATCH] [traffic] Consider routing MWMs when updating subscriptions on resume Signed-off-by: mvglasow --- map/traffic_manager.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/map/traffic_manager.cpp b/map/traffic_manager.cpp index c7068c921..07b5cab21 100644 --- a/map/traffic_manager.cpp +++ b/map/traffic_manager.cpp @@ -341,7 +341,24 @@ void TrafficManager::RecalculateSubscription() UpdateViewport(m_currentModelView.first); if (m_currentPosition.second) UpdateMyPosition(m_currentPosition.first); - // TODO update routing – if needed + + { + std::lock_guard lock(m_mutex); + + /* + * If UpdateViewport() or UpdateMyPosition() had changes, they would also have updated the + * routing MWMs and reset m_activeMwmsChanged. If neither of them had changes and + * m_activeMwmsChanged is true, it indicates changes in route MWMs which we need to process. + */ + if (m_activeMwmsChanged) + { + if ((m_activeDrapeMwms.empty() && m_activePositionMwms.empty() && m_activeRoutingMwms.empty()) + || IsInvalidState() || m_isPaused) + return; + + m_condition.notify_one(); + } + } } void TrafficManager::Invalidate(MwmSet::MwmId const & mwmId)