summaryrefslogtreecommitdiff
path: root/navit
diff options
context:
space:
mode:
authortinloaf <tinloaf@ffa7fe5e-494d-0410-b361-a75ebd5db220>2008-10-14 22:37:11 +0000
committertinloaf <tinloaf@ffa7fe5e-494d-0410-b361-a75ebd5db220>2008-10-14 22:37:11 +0000
commit9429bcf82a23181d4934658c4f22a1950bc96ed3 (patch)
tree5effd8d6fd861a7165bb4182c17e2a326e9844b5 /navit
parent6c7a97d48d408583e7661f1adcd6b1c926dde372 (diff)
downloadnavit-svn-9429bcf82a23181d4934658c4f22a1950bc96ed3.tar.gz
Fix:Core:Fixing bug with paths that have connections which are not
segment->end to segment->start. git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@1469 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit')
-rw-r--r--navit/route.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/navit/route.c b/navit/route.c
index ff2ada9c..72f123ea 100644
--- a/navit/route.c
+++ b/navit/route.c
@@ -1316,11 +1316,10 @@ route_road_angle(struct coord *c1, struct coord *c2, int dir)
*
* @param seg_from Segment we are driving from
* @param seg_to Segment we are driving to
- * @param dir Set to true to indicate that seg_from is left throught its "start" instead through its "end"
* @return True if driving from seg_from to seg_to is "straight", false otherwise
*/
static int
-route_check_straight(struct route_graph_segment *seg_from, struct route_graph_segment *seg_to, int dir)
+route_check_straight(struct route_graph_segment *seg_from, struct route_graph_segment *seg_to)
{
struct route_graph_segment *curr;
struct route_graph_point *conn;
@@ -1328,28 +1327,22 @@ route_check_straight(struct route_graph_segment *seg_from, struct route_graph_se
int ccnt;
struct coord ca[2048];
- if (!dir) {
- if ((seg_from->end != seg_to->start) && (seg_from->end != seg_to->end)) {
- // Not connected!
- return 0;
- }
-
+ if ((seg_from->end == seg_to->start) || (seg_from->end == seg_to->end)) {
ccnt = get_item_seg_coords(&seg_from->item, ca, 2047, &seg_from->start->c, &seg_from->end->c);
from_angle = route_road_angle(&ca[ccnt-2], &ca[ccnt-1],1);
conn = seg_from->end;
- } else {
- if ((seg_from->start != seg_to->start) && (seg_from->start != seg_to->end)) {
- // Not connected!
- return 0;
- }
-
+ } else if ((seg_from->start == seg_to->start) || (seg_from->start == seg_to->end)) {
ccnt = get_item_seg_coords(&seg_from->item, ca, 2, &seg_from->start->c, &seg_from->end->c);
from_angle = route_road_angle(&ca[1], &ca[0],1);
conn = seg_from->start;
+ } else {
+ // Not connected!
+ return 1;
}
+
if (seg_to->end == conn) {
ccnt = get_item_seg_coords(&seg_to->item, ca, 2047, &seg_to->start->c, &seg_to->end->c);
to_angle = route_road_angle(&ca[ccnt-1], &ca[ccnt-2],1);
@@ -1496,7 +1489,7 @@ route_path_new(struct route_graph *this, struct route_path *oldpath, struct rout
len+=seg_len;
if (lastseg) {
- is_straight = route_check_straight(lastseg,s,(s->end == start));
+ is_straight = route_check_straight(lastseg,s);
} else {
is_straight = 0;
}