From: Kaj-Michael Lang Date: Fri, 19 Oct 2007 12:56:45 +0000 (+0300) Subject: misc X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b4addd7dcf48d77b4bfebb75f57d647f43d9b51;p=mapper misc --- diff --git a/src/gpsdata.h b/src/gpsdata.h index dbd58b0..32665bc 100644 --- a/src/gpsdata.h +++ b/src/gpsdata.h @@ -5,6 +5,12 @@ #define GPS_SAT_MAX (12) +typedef enum { + FIX_NOFIX=1, + FIX_2D=2, + FIX_3D=3 +} GpsFix; + typedef struct _GpsSatelliteData GpsSatelliteData; struct _GpsSatelliteData { guint prn; diff --git a/src/map.c b/src/map.c index ab0f3f9..f5dc286 100644 --- a/src/map.c +++ b/src/map.c @@ -561,6 +561,10 @@ map_update_location_from_center(void) { /* Force re-validation of place if user is clicking around */ map_loc.valid=FALSE; +if (_gps.fix<2) { + _pos.unitx=_center.unitx; + _pos.unity=_center.unity; +} map_update_location(_center.unitx, _center.unity, TRUE); return FALSE; } diff --git a/src/route.c b/src/route.c index afc3241..f3e064b 100644 --- a/src/route.c +++ b/src/route.c @@ -565,7 +565,9 @@ if (_next_way) { _near_point_dist_squared = near_dist_squared; for (wnext = wcurr = _next_way; wcurr != _route.wtail; wcurr++) { - if (wcurr->point < near + if (wcurr->point < near || (wcurr->point == near && quick + && (_next_wpt && (DISTANCE_SQUARED(_pos, *near) > _next_way_dist_squared + && DISTANCE_SQUARED(_pos, *_next_wpt) < _next_wpt_dist_squared)))) /* Okay, this else if expression warrants explanation. If the * nearest track point happens to be a waypoint, then we want to * check if we have "passed" that waypoint. To check this, we @@ -574,16 +576,12 @@ if (_next_way) { * decreasing, then we have passed the waypoint, and thus we * should skip it. Note that if there is no _next_wpt, then * there is no next waypoint, so we do not skip it in that case. */ - || (wcurr->point == near && quick - && (_next_wpt && (DISTANCE_SQUARED(_pos, *near) > _next_way_dist_squared - && DISTANCE_SQUARED(_pos, *_next_wpt) < _next_wpt_dist_squared)))) wnext = wcurr + 1; else break; } - if (wnext == _route.wtail && (wnext->point < near - || (wnext->point == near && quick + if (wnext == _route.wtail && (wnext->point < near || (wnext->point == near && quick && (_next_wpt && (DISTANCE_SQUARED (_pos, *near) > _next_way_dist_squared && DISTANCE_SQUARED(_pos, *_next_wpt) < _next_wpt_dist_squared))))) { @@ -632,8 +630,7 @@ while (!_near_point->unity && _near_point != _route.tail) _near_point++; /* Initialize _next_way. */ -if (_route.wtail == _route.whead - 1 - || (_autoroute_data.enabled && _route.wtail == _route.whead)) +if (_route.wtail == _route.whead - 1 || (_autoroute_data.enabled && _route.wtail == _route.whead)) _next_way = NULL; else /* We have at least one waypoint. */