make sim layer use parking redirects. lots of aborted trips now fixed!

This commit is contained in:
Dustin Carlino 2019-08-21 14:40:29 -07:00
parent 3b0a228a2c
commit ed0ca15aef
2 changed files with 9 additions and 5 deletions

View File

@ -7,6 +7,8 @@ use map_model::{raw_data, AreaID, BuildingID, IntersectionID, LaneID, RoadID};
use sim::{PedestrianID, TripID};
use std::usize;
const WARP_TO_CAM_ZOOM: f64 = 10.0;
pub struct EnteringWarp;
impl EnteringWarp {
pub fn new() -> Box<State> {
@ -20,7 +22,7 @@ fn warp_to(wiz: &mut Wizard, ctx: &mut EventCtx, ui: &mut UI) -> Option<Transiti
if let Some((id, pt)) = warp_point(&to, &ui.primary) {
return Some(Transition::ReplaceWithMode(
Box::new(Warping {
warper: Warper::new(ctx, pt, None),
warper: Warper::new(ctx, pt, Some(WARP_TO_CAM_ZOOM)),
id: Some(id),
}),
EventLoopMode::Animation,

View File

@ -547,11 +547,13 @@ impl Map {
}
}
// When driving towards some goal building, there may not be a driving lane directly outside the
// building. So BFS out in a deterministic way and find one.
// Cars trying to park near this building should head for the driving lane returned here, then
// start their search. Some parking lanes are connected to driving lanes that're "parking
// blackholes" -- if there are no free spots on that lane, then the roads force cars to a
// border.
pub fn find_driving_lane_near_building(&self, b: BuildingID) -> LaneID {
if let Ok(l) = self.find_closest_lane_to_bldg(b, vec![LaneType::Driving]) {
return l;
return self.get_l(l).parking_blackhole.unwrap_or(l);
}
let mut roads_queue: VecDeque<RoadID> = VecDeque::new();
@ -579,7 +581,7 @@ impl Map {
.chain(r.children_backwards.iter())
{
if *lane_type == LaneType::Driving {
return *lane;
return self.get_l(*lane).parking_blackhole.unwrap_or(*lane);
}
}