diff --git a/.pkg b/.pkg index 593700514..ddfb9c760 100644 --- a/.pkg +++ b/.pkg @@ -101,7 +101,7 @@ [nigiri] url=git@github.com:motis-project/nigiri.git branch=master - commit=4adc2c34fd09b13a7b3cad3a4b4a756b5d04c6b7 + commit=bf9b9e98ef5ddf35a1d37defd0af55e459351f18 [osmium] url=git@github.com:motis-project/libosmium.git branch=master diff --git a/.pkg.lock b/.pkg.lock index 95b0857e0..2a88ff508 100644 --- a/.pkg.lock +++ b/.pkg.lock @@ -1,4 +1,4 @@ -14571522376964160082 +10322426052533489617 cista 49090f7891d069e6136efef1e730a4f24a190a81 zlib fe8e13ffca867612951bc6baf114e5ac8b00f305 boost be5235eb2258d2ec19e32546ab767a62311d9b46 @@ -29,7 +29,7 @@ abseil-cpp f2b3825f36e37fddd47c5c395096e9b1e99eca12 protobuf 690e03babf0963d3da9615a2dae0891777842719 unordered_dense 4f380fb1d64f1843ca2c993ed39a8342a8747e5d wyhash 1e012b57fc2227a9e583a57e2eacb3da99816d99 -nigiri 4adc2c34fd09b13a7b3cad3a4b4a756b5d04c6b7 +nigiri bf9b9e98ef5ddf35a1d37defd0af55e459351f18 lua 6898e2902fa5b890e0384e437abeb16034c61ece luabind 9223568bbcf818ecfb1001d49f567627ee10852a tbb 2067af88257710d07253761655a802732a32496e diff --git a/modules/intermodal/src/intermodal.cc b/modules/intermodal/src/intermodal.cc index 39dd6dab1..acf3f9d18 100644 --- a/modules/intermodal/src/intermodal.cc +++ b/modules/intermodal/src/intermodal.cc @@ -533,11 +533,15 @@ msg_ptr intermodal::route(msg_ptr const& msg) { mc.create_and_finish( MsgContent_RoutingRequest, - CreateRoutingRequest(mc, start.start_type_, start.start_, dest.station_, - req->search_type(), req->search_dir(), - mc.CreateVector(std::vector>{}), - mc.CreateVector(edges), true, true, true, 0, - timeout_) + CreateRoutingRequest( + mc, start.start_type_, start.start_, dest.station_, + req->search_type(), req->search_dir(), + mc.CreateVector(std::vector>{}), mc.CreateVector(edges), + true, true, true, 0, timeout_, + req->allowed_claszes() == nullptr + ? 0 + : mc.CreateVector(req->allowed_claszes()->Data(), + req->allowed_claszes()->size())) .Union(), router); diff --git a/modules/nigiri/src/routing.cc b/modules/nigiri/src/routing.cc index df2930ae5..8dbd8b3f9 100644 --- a/modules/nigiri/src/routing.cc +++ b/modules/nigiri/src/routing.cc @@ -145,6 +145,20 @@ auto run_search(n::routing::search_state& search_state, } } +n::routing::clasz_mask_t to_clasz_mask(fbs::Vector const* v) { + if (v == nullptr) { + return n::routing::all_clasz_allowed(); + } else { + auto mask = n::routing::clasz_mask_t{0U}; + for (auto const c : *v) { + utl::verify(c < static_cast(n::clasz::kNumClasses), + "clasz {} does not exist", c); + mask |= (1U << c); + } + return mask; + } +} + motis::module::msg_ptr route(tag_lookup const& tags, n::timetable const& tt, n::rt_timetable const* rtt, motis::module::msg_ptr const& msg, @@ -299,7 +313,8 @@ motis::module::msg_ptr route(tag_lookup const& tags, n::timetable const& tt, .min_connection_count_ = min_connection_count, .extend_interval_earlier_ = extend_interval_earlier, .extend_interval_later_ = extend_interval_later, - .prf_idx_ = prf_idx}; + .prf_idx_ = prf_idx, + .allowed_claszes_ = to_clasz_mask(req->allowed_claszes())}; utl::verify(!q.start_.empty(), "no start edges"); utl::verify(!q.destination_.empty(), "no destination edges"); diff --git a/protocol/intermodal/IntermodalRoutingRequest.fbs b/protocol/intermodal/IntermodalRoutingRequest.fbs index ddb94b6f2..f2a85ec8b 100644 --- a/protocol/intermodal/IntermodalRoutingRequest.fbs +++ b/protocol/intermodal/IntermodalRoutingRequest.fbs @@ -129,4 +129,5 @@ table IntermodalRoutingRequest { search_type: routing.SearchType; search_dir: motis.SearchDir; router: string (optional); + allowed_claszes: [ubyte] (optional); } diff --git a/protocol/routing/RoutingRequest.fbs b/protocol/routing/RoutingRequest.fbs index 05459e629..3cd7e47ca 100644 --- a/protocol/routing/RoutingRequest.fbs +++ b/protocol/routing/RoutingRequest.fbs @@ -115,4 +115,5 @@ table RoutingRequest { use_start_footpaths: bool = true; schedule: ulong; // schedule id (0 = default) timeout: int = 0; // 0 = none + allowed_claszes: [ubyte] (optional); }