From 44e74d1ed3ce7191f7f183a654c1dc81541815d8 Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Fri, 18 Oct 2019 12:50:48 -0700 Subject: [PATCH] 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 --- sim/src/make/spawner.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sim/src/make/spawner.rs b/sim/src/make/spawner.rs index 3cb8447ad4..5527776a8b 100644 --- a/sim/src/make/spawner.rs +++ b/sim/src/make/spawner.rs @@ -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(