]> err.no Git - mapper/blob - src/path.c
Parse directly but update informations in callbacks only if we got a sentence that...
[mapper] / src / path.c
1 #include <config.h>
2
3 #include "utils.h"
4 #include "map.h"
5 #include "route.h"
6 #include "mapper-types.h"
7
8 #include "track.h"
9 #include "path.h"
10
11 void 
12 path_resize(Path *path, guint size)
13 {
14 if (path->head + size != path->cap) {
15         Point *old_head = path->head;
16         WayPoint *curr;
17         path->head = g_renew(Point, old_head, size);
18         path->cap = path->head + size;
19         if (path->head != old_head) {
20                 path->tail = path->head + (path->tail - old_head);
21
22                 /* Adjust all of the waypoints. */
23                 for (curr = path->whead - 1; curr++ != path->wtail;)
24                         curr->point = path->head + (curr->point - old_head);
25         }
26 }
27 }
28
29 void 
30 path_wresize(Path *path, guint wsize)
31 {
32 if (path->whead + wsize != path->wcap) {
33         WayPoint *old_whead = path->whead;
34         path->whead = g_renew(WayPoint, old_whead, wsize);
35         path->wtail = path->whead + (path->wtail - old_whead);
36         path->wcap = path->whead + wsize;
37 }
38 }