diff --git a/map/framework.cpp b/map/framework.cpp index 46ac77ce13..e246e90b7f 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -2449,11 +2449,11 @@ void Framework::ActivateMapSelection(std::optional const & inf bool isSelectionShapeVisible = true; // TODO(a): to replace dummies with correct values. - if (m_currentPlacePageInfo->GetSponsoredType() == place_page::SponsoredType::Booking && - info->IsSearchMark()) + if (m_currentPlacePageInfo->GetSponsoredType() == place_page::SponsoredType::Booking) { - m_searchMarks.OnActivate(m_currentPlacePageInfo->GetID()); - isSelectionShapeVisible = false; + bool isMarkExists = false; + m_searchMarks.OnActivate(m_currentPlacePageInfo->GetID(), isMarkExists); + isSelectionShapeVisible = !isMarkExists; } CHECK_NOT_EQUAL(info->GetSelectedObject(), df::SelectionShape::OBJECT_EMPTY, ("Empty selections are impossible.")); @@ -2502,8 +2502,7 @@ void Framework::InvalidateUserMarks() void Framework::DeactivateHotelSearchMark() { - if (m_currentPlacePageInfo && m_currentPlacePageInfo->GetHotelType() && - m_currentPlacePageInfo->IsSearchMark()) + if (m_currentPlacePageInfo && m_currentPlacePageInfo->GetHotelType()) { if (GetSearchAPI().IsViewportSearchActive()) m_searchMarks.OnDeactivate(m_currentPlacePageInfo->GetID()); diff --git a/map/search_mark.cpp b/map/search_mark.cpp index 2b91a02a16..f09af97b3c 100644 --- a/map/search_mark.cpp +++ b/map/search_mark.cpp @@ -808,17 +808,20 @@ void SearchMarks::SetPrices(std::vector const & features, std::vector }); } -void SearchMarks::OnActivate(FeatureID const & featureId) +void SearchMarks::OnActivate(FeatureID const & featureId, bool & isMarkExists) { { std::scoped_lock lock(m_lock); m_selected = featureId; } - ProcessMarks([&featureId](SearchMarkPoint * mark) -> base::ControlFlow + isMarkExists = false; + ProcessMarks([&featureId, &isMarkExists](SearchMarkPoint * mark) -> base::ControlFlow { if (featureId != mark->GetFeatureID()) return base::ControlFlow::Continue; + isMarkExists = true; + mark->SetSelected(true); if (!mark->IsAvailable()) diff --git a/map/search_mark.hpp b/map/search_mark.hpp index 5303e2f900..9b6a5bfe3e 100644 --- a/map/search_mark.hpp +++ b/map/search_mark.hpp @@ -125,7 +125,7 @@ public: // NOTE: Vector of features must be sorted. void SetPrices(std::vector const & features, std::vector && prices); - void OnActivate(FeatureID const & featureId); + void OnActivate(FeatureID const & featureId, bool & isMarkExists); void OnDeactivate(FeatureID const & featureId); void SetUnavailable(SearchMarkPoint & mark, std::string const & reasonKey);