X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/0654760a65cb754c4254faa7b38171921ccfb64a..92dce2efe9fd69cd6bb5e038e2f6a63a23da2a5c:/src/viktrack.c?ds=inline diff --git a/src/viktrack.c b/src/viktrack.c index 359dc4f8..e03d8aa2 100644 --- a/src/viktrack.c +++ b/src/viktrack.c @@ -18,13 +18,20 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include -#include #include +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_MATH_H #include +#endif + #include "coords.h" #include "vikcoord.h" #include "viktrack.h" @@ -108,9 +115,12 @@ VikTrack *vik_track_copy ( const VikTrack *tr ) VikTrackpoint *vik_trackpoint_new() { VikTrackpoint *tp = g_malloc0(sizeof(VikTrackpoint)); - tp->extended = FALSE; tp->speed = NAN; tp->course = NAN; + tp->altitude = VIK_DEFAULT_ALTITUDE; + tp->hdop = VIK_DEFAULT_DOP; + tp->vdop = VIK_DEFAULT_DOP; + tp->pdop = VIK_DEFAULT_DOP; return tp; } @@ -369,8 +379,10 @@ gdouble *vik_track_make_elevation_map ( const VikTrack *tr, guint16 num_chunks ) chunk_length = total_length / num_chunks; /* Zero chunk_length (eg, track of 2 tp with the same loc) will cause crash */ - if (chunk_length <= 0) + if (chunk_length <= 0) { + g_free(pts); return NULL; + } current_dist = 0.0; current_area_under_curve = 0;