mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 09:24:26 +03:00
Add some disabled validation that paths don't enter an access-restricted zone when they shouldn't.
I'm working on an overhaul to pathfinding and zones in another branch, and need some more debugging tools. This one's ready to be checked in now.
This commit is contained in:
parent
c68d0fdc6b
commit
9d2da632be
@ -132,6 +132,9 @@ impl Path {
|
|||||||
if false {
|
if false {
|
||||||
validate_restrictions(map, &steps);
|
validate_restrictions(map, &steps);
|
||||||
}
|
}
|
||||||
|
if false {
|
||||||
|
validate_zones(map, &steps, &orig_req);
|
||||||
|
}
|
||||||
let mut path = Path {
|
let mut path = Path {
|
||||||
steps: VecDeque::from(steps),
|
steps: VecDeque::from(steps),
|
||||||
orig_req,
|
orig_req,
|
||||||
@ -645,6 +648,33 @@ fn validate_restrictions(map: &Map, steps: &Vec<PathStep>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn validate_zones(map: &Map, steps: &Vec<PathStep>, req: &PathRequest) {
|
||||||
|
let z1 = map.get_parent(req.start.lane()).get_zone(map);
|
||||||
|
let z2 = map.get_parent(req.end.lane()).get_zone(map);
|
||||||
|
|
||||||
|
for step in steps {
|
||||||
|
if let PathStep::Turn(t) = step {
|
||||||
|
if map
|
||||||
|
.get_parent(t.src)
|
||||||
|
.access_restrictions
|
||||||
|
.allow_through_traffic
|
||||||
|
.contains(req.constraints)
|
||||||
|
&& !map
|
||||||
|
.get_parent(t.dst)
|
||||||
|
.access_restrictions
|
||||||
|
.allow_through_traffic
|
||||||
|
.contains(req.constraints)
|
||||||
|
{
|
||||||
|
// Maybe it's fine
|
||||||
|
let into_zone = map.get_parent(t.dst).get_zone(map);
|
||||||
|
if into_zone != z1 && into_zone != z2 {
|
||||||
|
error!("{} causes illegal entrance into a zone at {}", req, t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Tuneable parameters for all types of routing.
|
/// Tuneable parameters for all types of routing.
|
||||||
// These will maybe become part of the PathRequest later, but that's an extremely invasive and
|
// These will maybe become part of the PathRequest later, but that's an extremely invasive and
|
||||||
// space-expensive change right now.
|
// space-expensive change right now.
|
||||||
|
Loading…
Reference in New Issue
Block a user