Woops, the include_dir change yesterday broke manually specified traffic

signals. Also they weren't being fully validated, so added that paranoia
check.
This commit is contained in:
Dustin Carlino 2021-01-10 18:19:12 -08:00
parent 5af0e7da24
commit 084a8941ab
2 changed files with 5 additions and 3 deletions

View File

@ -17,7 +17,7 @@ pub fn get_possible_policies(map: &Map, id: IntersectionID) -> Vec<(String, Cont
.unwrap() .unwrap()
.remove(&map.get_i(id).orig_id.0) .remove(&map.get_i(id).orig_id.0)
{ {
match ControlTrafficSignal::import(raw, id, map) { match ControlTrafficSignal::import(raw, id, map).and_then(|ts| ts.validate().map(|_| ts)) {
Ok(ts) => { Ok(ts) => {
results.push(("manually specified settings".to_string(), ts)); results.push(("manually specified settings".to_string(), ts));
} }

View File

@ -77,9 +77,11 @@ pub struct DirectedRoad {
pub is_forwards: bool, pub is_forwards: bool,
} }
static DATA: include_dir::Dir = include_dir::include_dir!("data"); // "" means include all files within data. My hacks to the include_dir crate need a better API.
static DATA: include_dir::Dir = include_dir::include_dir!("data", "");
/// Returns all traffic signal data compiled into this build, keyed by OSM node ID. /// Returns all traffic signal data compiled into this build, keyed by OSM node ID. If any single
/// file is broken, returns an error for the entire load.
// TODO Use a build script to do this. But have to generate Rust code to populate the struct? // TODO Use a build script to do this. But have to generate Rust code to populate the struct?
pub fn load_all_data() -> Result<BTreeMap<i64, TrafficSignal>, std::io::Error> { pub fn load_all_data() -> Result<BTreeMap<i64, TrafficSignal>, std::io::Error> {
let mut results = BTreeMap::new(); let mut results = BTreeMap::new();