mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 17:37:22 +03:00
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:
parent
56a277a284
commit
44e74d1ed3
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user