diff --git a/apps/ltn/src/filters/mod.rs b/apps/ltn/src/filters/mod.rs index a04d59ee16..e8ec16d916 100644 --- a/apps/ltn/src/filters/mod.rs +++ b/apps/ltn/src/filters/mod.rs @@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize}; use abstutil::{deserialize_btreemap, serialize_btreemap}; use geom::{Circle, Distance, Line}; -use map_model::{IntersectionID, Map, RoadID, RoutingParams, TurnID}; +use map_model::{IntersectionID, Map, PathConstraints, RoadID, RoutingParams, TurnID}; use widgetry::mapspace::{DrawUnzoomedShapes, ToggleZoomed}; use widgetry::{EventCtx, GeomBatch, GfxCtx}; @@ -200,7 +200,7 @@ impl DiagonalFilter { /// The caller must call this in a `before_edit` / `after_edit` "transaction." pub fn cycle_through_alternatives(app: &mut App, i: IntersectionID) { let map = &app.map; - let roads = map.get_i(i).get_roads_sorted_by_incoming_angle(map); + let mut roads = map.get_i(i).get_roads_sorted_by_incoming_angle(map); if roads.len() == 4 { // 4-way intersections are the only place where true diagonal filters can be placed @@ -224,6 +224,16 @@ impl DiagonalFilter { } else if roads.len() > 1 { // Diagonal filters elsewhere don't really make sense. They're equivalent to filtering // one road. Just cycle through those. + + // But skip roads that're aren't filterable + roads.retain(|r| { + let road = app.map.get_r(*r); + // Include non-driveable roads in this check, since we haven't filtered those out yet + road.oneway_for_driving().is_none() + && !road.is_deadend(&app.map) + && PathConstraints::Car.can_use_road(road, &app.map) + }); + let mut add_filter_to = None; if let Some(idx) = roads .iter()