mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-25 07:25:47 +03:00
Clean up some of the trips state when abruptly deleting agents. #312
This commit is contained in:
parent
d98c5bc6bc
commit
adcd0f65fe
@ -912,6 +912,7 @@ impl Sim {
|
||||
Some(vehicle),
|
||||
&mut ctx,
|
||||
);
|
||||
self.trips.trip_abruptly_cancelled(trip, AgentID::Car(car));
|
||||
}
|
||||
AgentID::Pedestrian(ped) => {
|
||||
self.walking.delete_ped(ped, &mut ctx);
|
||||
@ -922,6 +923,8 @@ impl Sim {
|
||||
None,
|
||||
&mut ctx,
|
||||
);
|
||||
self.trips
|
||||
.trip_abruptly_cancelled(trip, AgentID::Pedestrian(ped));
|
||||
}
|
||||
AgentID::BusPassenger(_, _) => unreachable!(),
|
||||
}
|
||||
|
@ -823,6 +823,10 @@ impl TripManager {
|
||||
self.person_finished_trip(now, person, ctx);
|
||||
}
|
||||
|
||||
pub fn trip_abruptly_cancelled(&mut self, trip: TripID, agent: AgentID) {
|
||||
assert_eq!(self.active_trip_mode.remove(&agent), Some(trip));
|
||||
}
|
||||
|
||||
pub fn active_agents(&self) -> Vec<AgentID> {
|
||||
self.active_trip_mode.keys().cloned().collect()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user