pub fn recalculate_pathfinding_after_edits(&mut self, timer: &mut Timer) {
        if !self.pathfinder_dirty {
            return;
        }

        let mut pathfinder = std::mem::replace(&mut self.pathfinder, Pathfinder::empty());
        pathfinder.apply_edits(self, timer);
        self.pathfinder = pathfinder;

        // Also recompute blackholes. This is cheap enough to do from scratch.
        timer.start("recompute blackholes");
        for l in self.lanes.values_mut() {
            l.driving_blackhole = false;
            l.biking_blackhole = false;
        }
        for l in connectivity::find_scc(self, PathConstraints::Car).1 {
            self.lanes.get_mut(&l).unwrap().driving_blackhole = true;
        }
        for l in connectivity::find_scc(self, PathConstraints::Bike).1 {
            self.lanes.get_mut(&l).unwrap().biking_blackhole = true;
        }
        timer.stop("recompute blackholes");

        self.pathfinder_dirty = false;
    }
/// This can expensive, so don't constantly do it while editing in the UI. But this must happen
/// before the simulation resumes.
This can expensive, so don't constantly do it while editing in the UI. But this must happen
before the simulation resumes.
This can expensive so don ' t constantly do it while editing in the UI . But this must happen before the simulation resumes .
pub fn recalculate_pathfinding_after_edits(&mut self, timer: &mut Timer) {
        if !self.pathfinder_dirty {
            return;
        }
        let mut pathfinder = std::mem::replace(&mut self.pathfinder, Pathfinder::empty());
        pathfinder.apply_edits(self, timer);
        self.pathfinder = pathfinder;
        // Also recompute blackholes. This is cheap enough to do from scratch.
        timer.start("recompute blackholes");
        for l in self.lanes.values_mut() {
            l.driving_blackhole = false;
            l.biking_blackhole = false;
        }
        for l in connectivity::find_scc(self, PathConstraints::Car).1 {
            self.lanes.get_mut(&l).unwrap().driving_blackhole = true;
        }
        for l in connectivity::find_scc(self, PathConstraints::Bike).1 {
            self.lanes.get_mut(&l).unwrap().biking_blackhole = true;
        }
        timer.stop("recompute blackholes");
        self.pathfinder_dirty = false;
    }
pub fn recalculate_pathfinding_after_edits ( & mut self , timer : & mut Timer ) { if ! self . pathfinder_dirty { return ; } let mut pathfinder = std :: mem :: replace ( & mut self . pathfinder , Pathfinder :: empty ( ) ) ; pathfinder . apply_edits ( self , timer ) ; self . pathfinder = pathfinder ; // Also recompute blackholes. This is cheap enough to do from scratch. timer . start ( " " ) ; for l in self . lanes . values_mut ( ) { l . driving_blackhole = false ; l . biking_blackhole = false ; } for l in connectivity :: find_scc ( self , PathConstraints :: Car ) . 1 { self . lanes . get_mut ( & l ) . unwrap ( ) . driving_blackhole = true ; } for l in connectivity :: find_scc ( self , PathConstraints :: Bike ) . 1 { self . lanes . get_mut ( & l ) . unwrap ( ) . biking_blackhole = true ; } timer . stop ( " " ) ; self . pathfinder_dirty = false ; }
This can expensive, so don't constantly do it while editing in the UI.
This can expensive so don ' t constantly do it while editing in the UI .
&mut self
timer
&mut Timer