trips from border to a bldg make that bldg own the car, so it can be reused. vastly reduces the number of aborted trips in the full montlake run

This commit is contained in:
Dustin Carlino 2019-10-18 12:50:48 -07:00
parent 56a277a284
commit 44e74d1ed3

View File

@ -184,7 +184,15 @@ impl TripSpawner {
goal,
ped_speed,
} => {
let vehicle = vehicle_spec.make(car_id.unwrap(), None);
// Assumption: If a car is appearing at a border and driving to a building,
// then it's owned by that building. Otherwise we wind up with endless waves of
// parked cars that're never reused.
let owner = if let DrivingGoal::ParkNear(b) = goal {
Some(b)
} else {
None
};
let vehicle = vehicle_spec.make(car_id.unwrap(), owner);
let mut legs = vec![TripLeg::Drive(vehicle.clone(), goal.clone())];
if let DrivingGoal::ParkNear(b) = goal {
legs.push(TripLeg::Walk(