Fix:Core:Generate Navigation when other ramp is also passable
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 9 Mar 2009 10:50:27 +0000 (10:50 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 9 Mar 2009 10:50:27 +0000 (10:50 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@2089 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/navigation.c
navit/navit/navigation.h

index 63f738d..3c6a9be 100644 (file)
@@ -123,6 +123,22 @@ angle_opposite(int angle)
        return ((angle+180)%360);
 }
 
+int
+navigation_get_attr(struct navigation *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
+{
+       dbg(0,"enter %s\n", attr_to_name(type));
+       switch (type) {
+       case attr_map:
+               attr->u.map=this_->map;
+               break;
+       default:
+               return 0;       
+       }
+       attr->type=type;
+       return 1;
+}
+
+
 struct navigation *
 navigation_new(struct attr *parent, struct attr **attrs)
 {
@@ -969,9 +985,8 @@ maneuver_required2(struct navigation_itm *old, struct navigation_itm *new, int *
        if (!new->ways) {
                /* No announcement necessary */
                r="no: Only one possibility";
-       } else if (!new->ways->next && new->ways->item.type == type_ramp) {
+       } else if (!new->ways->next && new->ways->item.type == type_ramp && !is_way_allowed(new->ways)) {
                /* If the other way is only a ramp and it is one-way in the wrong direction, no announcement necessary */
-               /* TODO: check for one way in wrong direction */
                r="no: Only ramp";
        }
        if (! r) {
index ae6c721..820c87f 100644 (file)
@@ -27,10 +27,12 @@ extern "C" {
 enum attr_type;
 enum item_type;
 struct attr;
+struct attr_iter;
 struct callback;
 struct map;
 struct navigation;
 struct route;
+int navigation_get_attr(struct navigation *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
 struct navigation *navigation_new(struct attr *parent, struct attr **attrs);
 int navigation_set_announce(struct navigation *this_, enum item_type type, int *level);
 void navigation_destroy(struct navigation *this_);