summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2008-05-12 17:08:22 +0000
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2008-05-12 17:08:22 +0000
commit81f49c2173892b9c4efcf6a8dd87aa1d11922f15 (patch)
treeffdb313f145a82a21e72acef8378cb158f43b74f
parentc22a946a5bbf54526ac8bb35bd4b2420637ee920 (diff)
downloadnavit-svn-81f49c2173892b9c4efcf6a8dd87aa1d11922f15.tar.gz
Core:Fix:Make 'Please turn around' less sensible'
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit/src@1043 ffa7fe5e-494d-0410-b361-a75ebd5db220
-rw-r--r--navigation.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/navigation.c b/navigation.c
index faf95b0d..bad3b10b 100644
--- a/navigation.c
+++ b/navigation.c
@@ -46,6 +46,7 @@ struct navigation {
int level_last;
struct item item_last;
int turn_around;
+ int turn_around_limit;
int distance_turn;
int distance_last;
int announce[route_item_last-route_item_first+1][3];
@@ -69,6 +70,7 @@ navigation_new(struct attr **attrs)
ret->level_last=-2;
ret->distance_last=-2;
ret->distance_turn=50;
+ ret->turn_around_limit=3;
for (j = 0 ; j <= route_item_last-route_item_first ; j++) {
for (i = 0 ; i < 3 ; i++) {
@@ -532,7 +534,7 @@ show_maneuver(struct navigation *nav, struct navigation_itm *itm, struct navigat
if (type != attr_navigation_long_exact)
distance=round_distance(distance);
if (type == attr_navigation_speech) {
- if (nav->turn_around)
+ if (nav->turn_around && nav->turn_around == nav->turn_around_limit)
return g_strdup(_("When possible, please turn around"));
level=navigation_get_announce_level(nav, itm->item.type, distance);
dbg(1,"distance=%d level=%d type=0x%x\n", distance, level, itm->item.type);
@@ -599,7 +601,7 @@ navigation_call_callbacks(struct navigation *this_, int force_speech)
return;
callback_list_call(this_->callback, 1, &p);
distance=round_distance(this_->first->dest_length-this_->cmd_first->itm->dest_length);
- if (this_->turn_around) {
+ if (this_->turn_around && this_->turn_around == this_->turn_around_limit) {
if (distance > this_->distance_turn) {
this_->level_last=4;
level=4;
@@ -675,9 +677,13 @@ navigation_update(struct navigation *this_, struct route *route)
calculate_dest_distance(this_, incr);
dbg(2,"destination distance old=%d new=%d\n", this_->distance_last, this_->first->dest_length);
if (this_->first->dest_length > this_->distance_last && this_->distance_last >= 0)
- this_->turn_around=1;
+ this_->turn_around++;
else
- this_->turn_around=0;
+ this_->turn_around--;
+ if (this_->turn_around > this_->turn_around_limit)
+ this_->turn_around=this_->turn_around_limit;
+ else if (this_->turn_around < -this_->turn_around_limit+1)
+ this_->turn_around=-this_->turn_around_limit+1;
dbg(2,"turn_around=%d\n", this_->turn_around);
this_->distance_last=this_->first->dest_length;
profile(0,"end");