summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2013-05-26 13:24:33 +0000
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2013-05-26 13:24:33 +0000
commitb2de279c1c65c718b500533538e894bb47443128 (patch)
tree99c6dcd10b7c0c59227a550d8d93d5b771fd6314
parent8db949f38a84ddbac849bea5ba486d96fd4b809d (diff)
downloadnavit-b2de279c1c65c718b500533538e894bb47443128.tar.gz
Add:Core:New attribute turn_around_count for navigation
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@5516 ffa7fe5e-494d-0410-b361-a75ebd5db220
-rw-r--r--navit/navit/attr_def.h1
-rw-r--r--navit/navit/navigation.c21
2 files changed, 20 insertions, 2 deletions
diff --git a/navit/navit/attr_def.h b/navit/navit/attr_def.h
index 9f0d405a7..0a9a8e00b 100644
--- a/navit/navit/attr_def.h
+++ b/navit/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/navit/navigation.c b/navit/navit/navigation.c
index 70c256826..6f0a598b2 100644
--- a/navit/navit/navigation.c
+++ b/navit/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);
}