eliminate first_from - we go around just once

This commit is contained in:
Marcel Dejean 2021-12-17 13:49:09 -05:00 committed by Dustin Carlino
parent 52a26f8a12
commit 933127f021

View File

@ -76,9 +76,8 @@ pub fn make_walking_turns(map: &Map, i: &Intersection) -> Vec<Turn> {
let mut result: Vec<Turn> = Vec::new();
let mut from: Option<&Lane> = lanes[0];
let first_from = from.unwrap().id;
let mut adj = true;
for l in lanes.iter().skip(1).chain(lanes.iter()) {
for l in lanes.iter().skip(1).chain(lanes.iter().take(1)) {
if from.is_none() {
from = *l;
adj = true;
@ -110,11 +109,6 @@ pub fn make_walking_turns(map: &Map, i: &Intersection) -> Vec<Turn> {
from = Some(l2);
adj = true;
}
// Have we made it all the way around?
if first_from == from.unwrap().id {
break;
}
}
// If there are exactly two crosswalks they must be connected, so delete one.