From 3073f4c0d11dcc08dc2328a5f59e60ba5605b813 Mon Sep 17 00:00:00 2001 From: Moritz Kobitzsch Date: Fri, 30 Jun 2017 10:53:05 +0200 Subject: [PATCH] don't announce something if we loose exit numbers while on the ramp --- include/util/guidance/name_announcements.hpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/include/util/guidance/name_announcements.hpp b/include/util/guidance/name_announcements.hpp index 5892b9cfd..15c738e2a 100644 --- a/include/util/guidance/name_announcements.hpp +++ b/include/util/guidance/name_announcements.hpp @@ -130,9 +130,24 @@ inline bool requiresNameAnnounced(const std::string &from_name, (!from_name.empty() && from_ref.empty() && to_name.empty() && !to_ref.empty()); const auto pronunciation_changes = from_pronunciation != to_pronunciation; - const auto exits_change = from_exits != to_exits; - return !obvious_change || needs_announce || pronunciation_changes || exits_change; + // when exiting onto ramps, we need to be careful about exit numbers. These can often be only + // assigned to the first part of the ramp + // + // a . . b . c . . d + // ` e . . f + // + // could assign the exit number to `be` when exiting `abcd` instead of the full ramp. + // + // Issuing a new-name instruction here would result in the turn assuming the short segment to be + // irrelevant and remove the exit number in a collapse scenario. We don't want to issue any + // instruction from be-ef, since we only loose the exit number. So we want to make sure that we + // don't just loose an exit number, when exits change + const auto exits_change = from_exits != to_exits; + const auto looses_exit = (names_are_equal && !from_exits.empty() && to_exits.empty()); + + return !obvious_change || needs_announce || pronunciation_changes || + (exits_change && !looses_exit); } // Overload without suffix checking