Skip to content

Commit

Permalink
set cost, dist, and mode for first+last segment
Browse files Browse the repository at this point in the history
  • Loading branch information
felixguendling committed Oct 31, 2024
1 parent 72faf8d commit d7aacbe
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/route.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,16 @@ path reconstruct(ways const& w,
cost_t const cost,
direction const dir) {
auto n = dest_node;
auto segments = std::vector<path::segment>{{.polyline_ = dest.path_,
.from_level_ = dest.lvl_,
.to_level_ = dest.lvl_,
.from_ = node_idx_t::invalid(),
.to_ = node_idx_t::invalid(),
.way_ = way_idx_t::invalid()}};
auto segments = std::vector<path::segment>{
{.polyline_ = dest.path_,
.from_level_ = dest.lvl_,
.to_level_ = dest.lvl_,
.from_ = node_idx_t::invalid(),
.to_ = node_idx_t::invalid(),
.way_ = way_idx_t::invalid(),
.cost_ = dest.cost_,
.dist_ = static_cast<distance_t>(dest.dist_to_node_),
.mode_ = dest_node.get_mode()}};
auto dist = 0.0;
while (true) {
auto const& e = d.cost_.at(n.get_key());
Expand All @@ -186,8 +190,9 @@ path reconstruct(ways const& w,
dir == direction::kBackward ? n.get_node() : node_idx_t::invalid(),
.to_ = dir == direction::kForward ? n.get_node() : node_idx_t::invalid(),
.way_ = way_idx_t::invalid(),
.cost_ = kInfeasible,
.dist_ = 0});
.cost_ = start_node.cost_,
.dist_ = static_cast<distance_t>(start_node.dist_to_node_),
.mode_ = n.get_mode()});
std::reverse(begin(segments), end(segments));
auto p = path{.cost_ = cost,
.dist_ = start_node.dist_to_node_ + dist + dest.dist_to_node_,
Expand Down

0 comments on commit d7aacbe

Please sign in to comment.