mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 17:37:22 +03:00
fix problem with trace_route requesting invalid start dist
This commit is contained in:
parent
452677672f
commit
ec49d2dd20
@ -25,7 +25,7 @@ pub use polyline::PolyLine;
|
||||
pub use pt::{HashablePt2D, Pt2D};
|
||||
use std::marker;
|
||||
|
||||
// About .0 inches... which is quite tiny on the scale of things. :)
|
||||
// About 0.4 inches... which is quite tiny on the scale of things. :)
|
||||
pub const EPSILON_DIST: si::Meter<f64> = si::Meter {
|
||||
value_unsafe: 0.01,
|
||||
_marker: marker::PhantomData,
|
||||
|
@ -284,6 +284,12 @@ impl Car {
|
||||
// from AORTA, IIRC, is to make cars stop anywhere in a small buffer at the end of the
|
||||
// lane.
|
||||
if leftover_dist <= EPSILON_DIST {
|
||||
if leftover_dist > 0.0 * si::M {
|
||||
// But do force them to be right at the end of the Traversable, otherwise we're
|
||||
// in this bizarre, illegal state where dist_along is > the current
|
||||
// Traversable's length.
|
||||
self.dist_along = self.on.length(map) - EPSILON_DIST;
|
||||
}
|
||||
break;
|
||||
}
|
||||
let next_on = match self.on {
|
||||
|
Loading…
Reference in New Issue
Block a user