mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-28 12:12:00 +03:00
show count of aborted trips in scoreboard too
This commit is contained in:
parent
909ce857fb
commit
2e5649bf7e
@ -43,6 +43,12 @@ impl Scoreboard {
|
||||
Line(prettyprint_usize(t2.unfinished_trips)).fg(Color::CYAN),
|
||||
Line(" unfinished trips"),
|
||||
]);
|
||||
summary.add_appended(vec![
|
||||
Line(prettyprint_usize(t1.aborted_trips)).fg(Color::RED),
|
||||
Line(" | "),
|
||||
Line(prettyprint_usize(t2.aborted_trips)).fg(Color::CYAN),
|
||||
Line(" aborted trips"),
|
||||
]);
|
||||
summary.add_appended(vec![
|
||||
Line("faster (better)").fg(Color::GREEN),
|
||||
Line(" / "),
|
||||
|
@ -36,6 +36,10 @@ impl Scoreboard {
|
||||
Line(prettyprint_usize(t.unfinished_trips)).fg(Color::CYAN),
|
||||
Line(" unfinished trips"),
|
||||
]);
|
||||
summary.add_appended(vec![
|
||||
Line(prettyprint_usize(t.aborted_trips)).fg(Color::CYAN),
|
||||
Line(" aborted trips"),
|
||||
]);
|
||||
|
||||
for (mode, trips) in &t
|
||||
.finished_trips
|
||||
|
@ -463,6 +463,7 @@ impl TripManager {
|
||||
pub fn get_finished_trips(&self) -> FinishedTrips {
|
||||
let mut result = FinishedTrips {
|
||||
unfinished_trips: self.unfinished_trips,
|
||||
aborted_trips: 0,
|
||||
finished_trips: Vec::new(),
|
||||
};
|
||||
for t in &self.trips {
|
||||
@ -470,6 +471,8 @@ impl TripManager {
|
||||
result
|
||||
.finished_trips
|
||||
.push((t.id, t.mode, end - t.spawned_at));
|
||||
} else if t.aborted {
|
||||
result.aborted_trips += 1;
|
||||
}
|
||||
}
|
||||
result
|
||||
@ -579,6 +582,7 @@ pub enum TripLeg {
|
||||
// As of a moment in time, not necessarily the end of the simulation
|
||||
pub struct FinishedTrips {
|
||||
pub unfinished_trips: usize,
|
||||
pub aborted_trips: usize,
|
||||
// (..., ..., time to complete trip)
|
||||
pub finished_trips: Vec<(TripID, TripMode, Duration)>,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user