mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-28 03:35:51 +03:00
Fix an edge case for cell connectivity
This commit is contained in:
parent
3a60a465e0
commit
6b79201d21
@ -139,14 +139,14 @@ fn only_one_border(app: &mut App, neighborhood: &Neighborhood) {
|
||||
.modal_filters
|
||||
.roads
|
||||
.insert(road.id, 0.1 * road.length());
|
||||
break;
|
||||
} else if road.dst_i == *i {
|
||||
app.session
|
||||
.modal_filters
|
||||
.roads
|
||||
.insert(road.id, 0.9 * road.length());
|
||||
break;
|
||||
}
|
||||
// Sometimes a cell has multiple roads connecing to the same border, so don't
|
||||
// stop looking even once we add one filter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -270,14 +270,17 @@ fn floodfill(
|
||||
},
|
||||
);
|
||||
for i in [current.src_i, current.dst_i] {
|
||||
// It's possible for one border intersection to have two roads in the interior of the
|
||||
// neighborhood. Don't consider a turn between those roads through this intersection as
|
||||
// counting as connectivity -- we're right at the boundary road, so it's like leaving
|
||||
// and re-entering the neighborhood.
|
||||
if neighborhood_borders.contains(&i) {
|
||||
cell_borders.insert(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
for next in &map.get_i(i).roads {
|
||||
let next_road = map.get_r(*next);
|
||||
if !perimeter.interior.contains(next) {
|
||||
if neighborhood_borders.contains(&i) {
|
||||
cell_borders.insert(i);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if let Some(filter) = modal_filters.intersections.get(&i) {
|
||||
if !filter.allows_turn(current.id, *next) {
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user