From 4ecf6a815fd674c6c2ab70dfbc02fcb654e4a7b5 Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Mon, 1 Apr 2019 13:49:34 +0900 Subject: [PATCH] make sure to recalculate DrawLanes based on turn priorities changing --- map_model/src/map.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/map_model/src/map.rs b/map_model/src/map.rs index 132634a083..269a134b30 100644 --- a/map_model/src/map.rs +++ b/map_model/src/map.rs @@ -563,7 +563,7 @@ impl Map { &mut self, new_edits: MapEdits, timer: &mut Timer, - ) -> (Vec, BTreeSet, BTreeSet) { + ) -> (BTreeSet, BTreeSet, BTreeSet) { // Ignore if there's no change from current let mut all_lane_edits: BTreeMap = BTreeMap::new(); let mut all_stop_sign_edits: BTreeMap = BTreeMap::new(); @@ -609,10 +609,10 @@ impl Map { all_traffic_signals.len() )); - let mut changed_lanes = Vec::new(); + let mut changed_lanes = BTreeSet::new(); let mut changed_intersections = BTreeSet::new(); for (id, lt) in all_lane_edits { - changed_lanes.push(id); + changed_lanes.insert(id); let l = &mut self.lanes[id.0]; l.lane_type = lt; @@ -669,18 +669,24 @@ impl Map { } // Make sure all of the turns of modified intersections are re-added in the pathfinder; - // they might've become banned. + // they might've become banned. Lane markings may also change based on turn priorities. for (id, ss) in all_stop_sign_edits { self.stop_signs.insert(id, ss); for t in &self.get_i(id).turns { add_turns.insert(*t); } + for l in &self.get_i(id).incoming_lanes { + changed_lanes.insert(*l); + } } for (id, ts) in all_traffic_signals { self.traffic_signals.insert(id, ts); for t in &self.get_i(id).turns { add_turns.insert(*t); } + for l in &self.get_i(id).incoming_lanes { + changed_lanes.insert(*l); + } } let mut pathfinder = self.pathfinder.take().unwrap();