summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjandegr <jandegr@users.noreply.github.com>2016-09-04 13:14:57 +0200
committerGitHub <noreply@github.com>2016-09-04 13:14:57 +0200
commita8ca868f12be9d01c19e2160bdf915aaefca6957 (patch)
tree583332798c97f2d8a81b7c98300525d88c890304
parent03fe14e970bbe4e7dcd05381397f083c8eecfca2 (diff)
downloadnavit-a8ca868f12be9d01c19e2160bdf915aaefca6957.tar.gz
gui_internal: fix occasional crash of heightprofile
-rw-r--r--navit/gui/internal/gui_internal.c33
1 files changed, 12 insertions, 21 deletions
diff --git a/navit/gui/internal/gui_internal.c b/navit/gui/internal/gui_internal.c
index cf7db42a7..072c6feca 100644
--- a/navit/gui/internal/gui_internal.c
+++ b/navit/gui/internal/gui_internal.c
@@ -3118,12 +3118,14 @@ static struct gui_internal_widget_methods gui_internal_widget_methods = {
gui_internal_set_default_background,
};
-
-/*
- * @brief Displays Route information
+/**
+ * @brief finds the intersection point of 2 lines
+ *
+ * @param coord a1, a2, b1, b2 : coords of the start and
+ * end of the first and the second line
+ * @param coord res, will become the coords of the intersection if found
+ * @return : TRUE if intersection found, otherwise FALSE
*/
-/* FIXME where is the implementation? */
-
int
line_intersection(struct coord* a1, struct coord *a2, struct coord * b1, struct coord *b2, struct coord *res)
{
@@ -3141,18 +3143,19 @@ line_intersection(struct coord* a1, struct coord *a2, struct coord * b1, struct
b = -b;
}
if (a < 0 || b < 0)
- return 0;
+ return FALSE;
if (a > n || b > n)
- return 0;
+ return FALSE;
if (n == 0) {
dbg(lvl_info,"a=%d b=%d n=%d\n", a, b, n);
dbg(lvl_info,"a1=0x%x,0x%x ad %d,%d\n", a1->x, a1->y, adx, ady);
dbg(lvl_info,"b1=0x%x,0x%x bd %d,%d\n", b1->x, b1->y, bdx, bdy);
- dbg_assert(n != 0);
+ dbg(lvl_info,"No intersection found, lines assumed parallel ?\n");
+ return FALSE;
}
res->x = a1->x + a * adx / n;
res->y = a1->y + a * ady / n;
- return 1;
+ return TRUE;
}
struct heightline *
@@ -3182,18 +3185,6 @@ item_get_heightline(struct item *item)
return ret;
}
-
-/*
- * @brief Displays Route Height Profile
- *
- * @li The name of the active vehicle
- * @param wm The button that was pressed.
- * @param v Unused
- */
-/* FIXME where is the implementation? */
-
-
-
/**
* @brief Called when the route is updated.
*/