Skip to content

Commit

Permalink
Fix:core:Do not recalculate length when restoring traffic distortion …
Browse files Browse the repository at this point in the history
…items (#1116)

Signed-off-by: mvglasow <michael -at- vonglasow.com>

Co-authored-by: mvglasow <michael -at- vonglasow.com>
  • Loading branch information
mvglasow committed Apr 27, 2021
1 parent 488d07f commit 3046130
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions navit/traffic.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ struct parsed_item {
struct attr **attrs; /**< The attributes for the item, `NULL`-terminated */
struct coord *coords; /**< The coordinates for the item */
int coord_count; /**< The number of elements in `coords` */
int length; /**< The length of the segment in meters */
int delay; /**< Delay in deciseconds */
int is_matched; /**< Whether any of the maps has a matching item */
};

Expand Down Expand Up @@ -3436,9 +3436,6 @@ static int traffic_message_restore_segments(struct traffic_message * this_, stru
struct parsed_item * pitem;
struct item * item;

/* Location length */
int loc_len = 0;

/* List of parsed items */
GList * items = NULL, * curr_item;

Expand Down Expand Up @@ -3541,6 +3538,8 @@ static int traffic_message_restore_segments(struct traffic_message * this_, stru
pitem->coord_count = ccnt;
pitem->attrs = attr_list_dup(attrs);
for (i = 0; attrs[i]; i++) {
if (attrs[i]->type == attr_delay)
pitem->delay = attrs[i]->u.num;
g_free(attrs[i]);
attrs[i] = NULL;
}
Expand Down Expand Up @@ -3662,12 +3661,8 @@ static int traffic_message_restore_segments(struct traffic_message * this_, stru
dbg(lvl_debug, "*****checkpoint RESTORE-6.1, restoring segmented items is not supported yet");
map_item = NULL;
}
if (map_item) {
if (map_item)
pitem->is_matched = 1;
for (i = 1; i < pitem->coord_count; i++)
pitem->length += transform_distance(map_projection(m), &(ca[i-1]), &(ca[i]));
loc_len += pitem->length;
}
}
}

Expand Down Expand Up @@ -3704,8 +3699,7 @@ static int traffic_message_restore_segments(struct traffic_message * this_, stru
pitem->coords, pitem->coord_count, this_->id);
tm_item_add_message_data(item, this_->id,
traffic_get_item_speed(item, seg_data, maxspeed),
traffic_get_item_delay(seg_data->delay, pitem->length, loc_len),
NULL, route);
pitem->delay, NULL, route);
parsed_item_destroy(pitem);
this_->priv->items[i] = item;
i++;
Expand Down

0 comments on commit 3046130

Please sign in to comment.