From 9be94f9a704c1fae45a62a0c581089eb12ceb176 Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Mon, 20 Jul 2020 10:38:56 -0700 Subject: [PATCH] don't spawn bikes on tiny lanes, it causes queue spillover --- sim/src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sim/src/lib.rs b/sim/src/lib.rs index 3ade018095..b4455da512 100644 --- a/sim/src/lib.rs +++ b/sim/src/lib.rs @@ -440,9 +440,19 @@ impl SidewalkSpot { // Don't start biking on a blackhole! // TODO Maybe compute a separate blackhole graph that includes bike lanes. if let Some(redirect) = map.get_l(driving_lane).parking_blackhole { + // Make sure the driving lane is at least long enough to spawn on. Bikes spawn in the + // middle, so it needs to be double. + if map.get_l(redirect).length() < 2.0 * BIKE_LENGTH { + return None; + } + let new_sidewalk = map.get_parent(redirect).bike_to_sidewalk(redirect)?; SidewalkSpot::bike_rack(new_sidewalk, map) } else { + if map.get_l(driving_lane).length() < 2.0 * BIKE_LENGTH { + return None; + } + SidewalkSpot::bike_rack(sidewalk, map) } }