mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-29 04:35:51 +03:00
cancel turn requests when deleting a car forcibly
This commit is contained in:
parent
105f526e9e
commit
fb3e4e5177
@ -510,6 +510,9 @@ impl DrivingSimState {
|
||||
let queue = self.queues.get_mut(&car.router.head()).unwrap();
|
||||
queue.reserved_length += car.vehicle.length + FOLLOWING_DISTANCE;
|
||||
}
|
||||
if let Some(Traversable::Turn(t)) = car.router.maybe_next() {
|
||||
intersections.cancel_request(AgentID::Car(c), t);
|
||||
}
|
||||
|
||||
self.delete_car(&mut car, dists, idx, now, map, scheduler, intersections);
|
||||
// delete_car cancels UpdateLaggyHead
|
||||
|
@ -88,6 +88,12 @@ impl IntersectionSimState {
|
||||
}
|
||||
}
|
||||
|
||||
// For deleting cars
|
||||
pub fn cancel_request(&mut self, agent: AgentID, turn: TurnID) {
|
||||
let state = self.state.get_mut(&turn.parent).unwrap();
|
||||
state.waiting.remove(&Request { agent, turn });
|
||||
}
|
||||
|
||||
pub fn space_freed(&mut self, now: Duration, i: IntersectionID, scheduler: &mut Scheduler) {
|
||||
let state = self.state.get_mut(&i).unwrap();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user