static struct attr_name attr_names[]={
-#define ATTR2(x,y) ATTR(x)
+#define ATTR2(x,y) ATTR(y)
#define ATTR(x) { attr_##x, #x },
#include "attr_def.h"
#undef ATTR2
enum item_type;
enum attr_type {
-#define ATTR2(x,y) attr_##x=y,
+#define ATTR2(x,y) attr_##y=x,
#define ATTR(x) attr_##x,
#include "attr_def.h"
#undef ATTR2
/* prototypes */
/* common */
-ATTR2(none,0x00000000)
+ATTR2(0x00000000,none)
ATTR(any)
-ATTR2(type_item_begin,0x00010000)
+ATTR2(0x00010000,type_item_begin)
ATTR(town_streets_item)
ATTR(street_name_item)
ATTR(street_name_numbers_item)
ATTR(street_item)
ATTR(street_number_item)
ATTR(item_type)
-ATTR2(type_item_end,0x0001ffff)
+ATTR2(0x0001ffff,type_item_end)
-ATTR2(type_int_begin,0x00020000)
+ATTR2(0x00020000,type_int_begin)
ATTR(h)
ATTR(id)
ATTR(limit)
ATTR(flush_time)
/* boolean */
ATTR(overwrite)
-ATTR2(type_int_end,0x0002ffff)
+ATTR2(0x0002ffff,type_int_end)
-ATTR2(type_string_begin,0x00030000)
+ATTR2(0x00030000,type_string_begin)
ATTR(type)
ATTR(label)
ATTR(data)
ATTR(navigation_long)
ATTR(navigation_long_exact)
ATTR(navigation_speech)
-ATTR2(type_string_end,0x0003ffff)
+ATTR2(0x0003ffff,type_string_end)
g.lng=floor(lng/100);
lng-=g.lng*100;
g.lng+=lng/60;
+ if (ns == 's' || ns == 'S')
+ g.lat=-g.lat;
+ if (ew == 'w' || ew == 'W')
+ g.lng=-g.lng;
transform_from_geo(pro, &g, c_ret);
}
- if (debug) {
- printf("str='%s' x=%f ns=%c y=%f ew=%c c=%d\n", str, lng, ns, lat, ew, ret);
- printf("rest='%s'\n", str+ret);
- }
+ dbg(3,"str='%s' x=%f ns=%c y=%f ew=%c c=%d\n", str, lng, ns, lat, ew, ret);
+ dbg(3,"rest='%s'\n", str+ret);
} else {
double lng, lat;
args=sscanf(str, "%lf %lf%n", &lng, &lat, &ret);
if (!incr) {
printf("not on track\n");
rph=route_path_open(route);
- while((s=route_path_get_segment(rph))) {
- itm=navigation_itm_new(this_, route_path_segment_get_item(s),route_path_segment_get_start(s));
- itm->time=route_path_segment_get_time(s);
- itm->length=route_path_segment_get_length(s);
+ if (rph) {
+ while((s=route_path_get_segment(rph))) {
+ itm=navigation_itm_new(this_, route_path_segment_get_item(s),route_path_segment_get_start(s));
+ itm->time=route_path_segment_get_time(s);
+ itm->length=route_path_segment_get_length(s);
+ }
+ route_path_close(rph);
}
if (end_flag) {
len=route_info_length(NULL, dst, 0);
itm->time=route_time(speedlist, &sd->item, len);
}
itm=navigation_itm_new(this_, NULL, NULL);
- route_path_close(rph);
make_maneuvers(this_);
}
calculate_dest_distance(this_, incr);
struct route_path_handle *
route_path_open(struct route *this)
{
- struct route_path_handle *ret=g_new(struct route_path_handle, 1);
+ struct route_path_handle *ret;
+
+ if (! this->path2 || ! this->path2->path)
+ return NULL;
+
+ ret=g_new(struct route_path_handle, 1);
ret->s=this->path2->path;
return ret;
int i,dist,distn;
struct coord lp;
if (count < 2)
- return 0;
+ return INT_MAX;
if (pos)
*pos=0;
dist=transform_distance_line_sq(&c[0], &c[1], ref, lpnt);