mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-01 02:33:54 +03:00
count the peds moving/waiting too
This commit is contained in:
parent
ccbf5939d8
commit
c77415164e
@ -389,13 +389,14 @@ impl Sim {
|
||||
|
||||
pub fn summary(&self) -> String {
|
||||
let (waiting_cars, active_cars) = self.driving_state.get_active_and_waiting_count();
|
||||
let (waiting_peds, active_peds) = self.walking_state.get_active_and_waiting_count();
|
||||
format!(
|
||||
"Time: {0:.2}, {1} / {2} active cars waiting, {3} cars parked, {4} pedestrians",
|
||||
"Time: {0:.2}, {1} / {2} active cars waiting, {3} cars parked, {4} / {5} pedestrians waiting",
|
||||
self.time,
|
||||
waiting_cars,
|
||||
active_cars,
|
||||
self.parking_state.total_count(),
|
||||
self.walking_state.total_count(),
|
||||
waiting_peds, active_peds,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -177,10 +177,6 @@ impl WalkingSimState {
|
||||
// No-op
|
||||
}
|
||||
|
||||
pub fn total_count(&self) -> usize {
|
||||
self.id_counter
|
||||
}
|
||||
|
||||
pub fn step(
|
||||
&mut self,
|
||||
delta_time: Time,
|
||||
@ -311,6 +307,14 @@ impl WalkingSimState {
|
||||
info.leaders.insert(id);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_active_and_waiting_count(&self) -> (usize, usize) {
|
||||
let waiting = self.peds
|
||||
.values()
|
||||
.filter(|p| p.waiting_for.is_some())
|
||||
.count();
|
||||
(waiting, self.peds.len())
|
||||
}
|
||||
}
|
||||
|
||||
fn is_contraflow(map: &Map, from: LaneID, to: LaneID) -> bool {
|
||||
|
Loading…
Reference in New Issue
Block a user