From acdc0b1655f7f78cd093d17f5faa31f78885f725 Mon Sep 17 00:00:00 2001 From: sonora Date: Sun, 22 May 2016 10:05:04 +0200 Subject: [PATCH] fix orphaned turnIn statement after straight segments --- .../net/osmand/plus/routing/VoiceRouter.java | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java index fa3bb8eebe..aa3c481a7e 100644 --- a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java +++ b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java @@ -719,16 +719,29 @@ public class VoiceRouter { if ((nextNextInfo != null) && (nextNextInfo.directionInfo != null)) { String t2Param = getTurnType(nextNextInfo.directionInfo.getTurnType()); if (t2Param != null) { - if(isplay) { play.then(); } - play.turn(t2Param, nextNextInfo.distanceTo, empty); + if(isplay) { + play.then(); + play.turn(t2Param, nextNextInfo.distanceTo, empty); + } } else if (nextNextInfo.directionInfo.getTurnType().isRoundAbout()) { - if(isplay) { play.then(); } - play.roundAbout(nextNextInfo.distanceTo, nextNextInfo.directionInfo.getTurnType().getTurnAngle(), nextNextInfo.directionInfo.getTurnType().getExitOut(), empty); + if(isplay) { + play.then(); + play.roundAbout(nextNextInfo.distanceTo, nextNextInfo.directionInfo.getTurnType().getTurnAngle(), nextNextInfo.directionInfo.getTurnType().getExitOut(), empty); + } } else if (nextNextInfo.directionInfo.getTurnType().getValue() == TurnType.TU) { - if(isplay) { play.then(); } - play.makeUT(nextNextInfo.distanceTo, empty); + if(isplay) { + play.then(); + play.makeUT(nextNextInfo.distanceTo, empty); + } + } + + // This case only needed should we want another prompt at the end of straight segments (equivalent of makeTurn) and nextNextInfo should be announced again there. + if (nextNextInfo.directionInfo.getTurnType().getValue() != TurnType.C && next.getTurnType().getValue() == TurnType.C) { + play.goAhead(); + play.then(); + play.turn(t2Param, nextNextInfo.distanceTo, empty); + isplay = true; } - isplay = true; } if(isplay){ notifyOnVoiceMessage();