Skip to content

Commit

Permalink
swap START/END when ArriveBy is set (#747)
Browse files Browse the repository at this point in the history
  • Loading branch information
mority authored Feb 17, 2025
1 parent 8fa459b commit 1a20267
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/journey_to_response.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ api::ModeEnum to_mode(osr::search_profile const m) {
std::unreachable();
}

void cleanup_intermodal(api::Itinerary& i) {
if (i.legs_.front().from_.name_ == "END") {
i.legs_.front().from_.name_ = "START";
}
if (i.legs_.back().to_.name_ == "START") {
i.legs_.back().to_.name_ = "END";
}
}

api::Itinerary journey_to_response(osr::ways const* w,
osr::lookup const* l,
osr::platforms const* pl,
Expand Down Expand Up @@ -202,6 +211,8 @@ api::Itinerary journey_to_response(osr::ways const* w,
j_leg.uses_);
}

cleanup_intermodal(itinerary);

return itinerary;
}

Expand Down

0 comments on commit 1a20267

Please sign in to comment.