From 7c57d412bb35393f6ae97bd01b3028c9074dc5ec Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Sun, 27 Jan 2008 11:12:23 +0200 Subject: [PATCH] Don't allow negative headings --- src/gps.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gps.c b/src/gps.c index 06c9ac9..3ef0ebf 100644 --- a/src/gps.c +++ b/src/gps.c @@ -357,6 +357,7 @@ gps_simulate_move(Gps *gps) { static gdouble slat=0, slon=0; gdouble plat, plon; +gfloat h; g_assert(gps); if (g_random_double()<0.5) { @@ -373,7 +374,8 @@ BOUND(gps->data.lon, -80.0, 80.0); g_debug("Sim: %f %f\n", gps->data.lat, gps->data.lon); gps->data.speed=1+g_random_double_range(0.1, 10.0); -gps->data.heading=calculate_course(plat, plon, gps->data.lat, gps->data.lon); +h=calculate_course(plat, plon, gps->data.lat, gps->data.lon); +gps->data.heading=(h<0) ? 360+h : h; gps->data.time=time(NULL); gps_data_integerize(&gps->data); track_add(&gps->data, FALSE); -- 2.39.5