@@ -518,17 +518,17 @@ std::optional<path> route_bidirectional(ways const& w,
518518 return *direct;
519519 }
520520
521- b.reset (max, from, to);
522- if (b.radius_ == max) {
523- return std::nullopt ;
524- }
525-
526521 auto const limit_squared_max_matching_distance =
527522 geo::approx_squared_distance (from.pos_ , to.pos_ ,
528523 b.distance_lon_degrees_ ) /
529524 kMaxMatchingDistanceSquaredRatio ;
530525
531526 for (auto const accept_bad_max_matching_dist : {false , true }) {
527+ b.reset (max, from, to);
528+ if (b.radius_ == max) {
529+ return std::nullopt ;
530+ }
531+
532532 for (auto const [i, start] : utl::enumerate (from_match)) {
533533 if (b.max_reached_1_ && component_seen (w, from_match, i)) {
534534 continue ;
@@ -617,10 +617,10 @@ std::optional<path> route_dijkstra(ways const& w,
617617 }
618618
619619 auto const distance_lng_degrees = geo::approx_distance_lng_degrees (from.pos_ );
620-
621- d.reset (max);
622- auto should_continue = true ;
623620 for (auto const accept_bad_max_matching_dist : {false , true }) {
621+ d.reset (max);
622+ auto should_continue = true ;
623+
624624 auto const limit_squared_max_matching_distance =
625625 accept_bad_max_matching_dist
626626 ? std::numeric_limits<double >::max ()
@@ -694,9 +694,9 @@ std::vector<std::optional<path>> route(
694694 auto const distance_lng_degrees = geo::approx_distance_lng_degrees (from.pos_ );
695695
696696 d.reset (max);
697- auto should_continue = true ;
698697
699698 for (auto const accept_bad_max_matching_dist : {false , true }) {
699+ auto should_continue = true ;
700700 for (auto const [i, start] : utl::enumerate (from_match)) {
701701 if (!should_continue && component_seen (w, from_match, i)) {
702702 continue ;
0 commit comments