mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-01 19:27:11 +03:00
make follower proceed to end of lane after following. and classify
intervals for easier reading.
This commit is contained in:
parent
6b0a70268c
commit
8aee575056
@ -130,9 +130,22 @@ impl Interval {
|
||||
|
||||
impl fmt::Display for Interval {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let kind = if self.start_speed == Speed::ZERO && self.end_speed == Speed::ZERO {
|
||||
"wait"
|
||||
} else if self.start_speed == Speed::ZERO {
|
||||
"accelerate from rest"
|
||||
} else if self.end_speed == Speed::ZERO {
|
||||
"decelerate to rest"
|
||||
} else if self.start_speed == self.end_speed {
|
||||
"freeflow"
|
||||
} else {
|
||||
"other"
|
||||
};
|
||||
|
||||
write!(
|
||||
f,
|
||||
"{}->{} during {}->{} ({}->{})",
|
||||
"[{}] {}->{} during {}->{} ({}->{})",
|
||||
kind,
|
||||
self.start_dist,
|
||||
self.end_dist,
|
||||
self.start_time,
|
||||
|
@ -43,16 +43,13 @@ impl World {
|
||||
start_time: Duration::seconds(4.0),
|
||||
};
|
||||
follower.stop_at_end_of_lane(lane, speed_limit);
|
||||
follower.maybe_follow(&mut leader);
|
||||
follower.stop_at_end_of_lane(lane, speed_limit);
|
||||
follower.wait(Duration::seconds(5.0));
|
||||
|
||||
println!("Leader:\n");
|
||||
leader.dump_intervals();
|
||||
println!("\nOriginal follower:\n");
|
||||
follower.dump_intervals();
|
||||
println!();
|
||||
|
||||
follower.maybe_follow(&mut leader);
|
||||
println!("\nAdjusted follower:\n");
|
||||
println!("\nFollower:\n");
|
||||
follower.dump_intervals();
|
||||
println!();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user