summaryrefslogtreecommitdiff
path: root/navit
diff options
context:
space:
mode:
Diffstat (limited to 'navit')
-rw-r--r--navit/attr_def.h1
-rw-r--r--navit/navigation.c21
2 files changed, 20 insertions, 2 deletions
diff --git a/navit/attr_def.h b/navit/attr_def.h
index 9f0d405a7..0a9a8e00b 100644
--- a/navit/attr_def.h
+++ b/navit/attr_def.h
@@ -182,6 +182,7 @@ ATTR(battery_capacity_rel) /* ppm */
ATTR(battery_charge) /* mAh */
ATTR(battery_resistance) /* mOhm */
ATTR(battery_temperature) /* mK */
+ATTR(turn_around_count)
ATTR2(0x00027500,type_rel_abs_begin)
/* These attributes are int that can either hold relative *
* or absolute values. A relative value is indicated by *
diff --git a/navit/navigation.c b/navit/navigation.c
index 70c256826..6f0a598b2 100644
--- a/navit/navigation.c
+++ b/navit/navigation.c
@@ -84,6 +84,7 @@ struct navigation {
int tell_street_name;
int delay;
int curr_delay;
+ int turn_around_count;
};
int distances[]={1,2,3,4,5,10,25,50,75,100,150,200,250,300,400,500,750,-1};
@@ -141,7 +142,7 @@ navigation_get_attr(struct navigation *this_, enum attr_type type, struct attr *
{
struct map_rect *mr;
struct item *item;
- dbg(1,"enter %s\n", attr_to_name(type));
+ dbg(0,"enter %s\n", attr_to_name(type));
switch (type) {
case attr_map:
attr->u.map=this_->map;
@@ -165,6 +166,9 @@ navigation_get_attr(struct navigation *this_, enum attr_type type, struct attr *
if (!item)
return 0;
break;
+ case attr_turn_around_count:
+ attr->u.num=this_->turn_around_count;
+ break;
default:
return navit_object_get_attr((struct navit_object *)this_, type, attr, iter);
}
@@ -172,6 +176,16 @@ navigation_get_attr(struct navigation *this_, enum attr_type type, struct attr *
return 1;
}
+static void
+navigation_set_turnaround(struct navigation *this_, int val)
+{
+ if (this_->turn_around_count != val) {
+ struct attr attr=ATTR_INT(turn_around_count, val);
+ this_->turn_around_count=val;
+ navit_object_callbacks((struct navit_object *)this_, &attr);
+ }
+}
+
int
navigation_set_attr(struct navigation *this_, struct attr *attr)
{
@@ -1571,8 +1585,11 @@ 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 && nav->turn_around == nav->turn_around_limit)
+ if (nav->turn_around && nav->turn_around == nav->turn_around_limit) {
+ navigation_set_turnaround(nav, nav->turn_around_count+1);
return g_strdup(_("When possible, please turn around"));
+ }
+ navigation_set_turnaround(nav, 0);
if (!connect) {
level=navigation_get_announce_level_cmd(nav, itm, cmd, distance-cmd->length);
}