changing two lanes that share an intersection breaks... fix
@@ -583,14 +583,10 @@ impl Map {
}
let mut changed_lanes = Vec::new();
- let mut delete_turns = BTreeSet::new();
- let mut add_turns = BTreeSet::new();
+ let mut changed_intersections = BTreeSet::new();
for (id, lt) in all_lane_edits {
changed_lanes.push(id);
- // TODO Did something affect a border intersection?
-
- let (src, dst) = {
let l = &mut self.lanes[id.0];
l.lane_type = lt;
@@ -602,11 +598,15 @@ impl Map {
r.children_backwards[idx] = (l.id, l.lane_type);
}
- (l.src_i, l.dst_i)
- };
+ changed_intersections.insert(l.src_i);
+ changed_intersections.insert(l.dst_i);
+ }
// Recompute turns and intersection policy
- for id in vec![src, dst] {
+ let mut delete_turns = BTreeSet::new();
+ let mut add_turns = BTreeSet::new();
+ for id in changed_intersections {
+ // TODO Did something affect a border intersection?
let i = &mut self.intersections[id.0];
let mut old_turns = Vec::new();
@@ -639,7 +639,6 @@ impl Map {
IntersectionType::Border => {}
}
}
- }
let mut pathfinder = self.pathfinder.take().unwrap();
pathfinder.apply_edits(&delete_turns, &add_turns, self);
