dont spawn bikes on highway border nodes

This commit is contained in:
Dustin Carlino 2018-11-23 11:03:00 -08:00
parent 1ce55ada04
commit 2e8cd7ff7a
3 changed files with 11 additions and 1 deletions

View File

@ -21,6 +21,7 @@
- graph querying?
- rendering (and other UI/editor interactions)?
- sim state?
- Sidewalk, Parking, Street
- more data
- draw ALL water and greenery areas

View File

@ -173,4 +173,9 @@ impl Road {
)))
}
}
pub fn supports_bikes(&self) -> bool {
// TODO Should check LaneType to start
self.osm_tags.get("bicycle") != Some(&"no".to_string())
}
}

View File

@ -217,7 +217,11 @@ impl Scenario {
let mut starting_biking_lanes = map
.get_i(s.start_from_border)
.get_outgoing_lanes(map, LaneType::Biking);
starting_biking_lanes.extend(starting_driving_lanes);
for l in starting_driving_lanes {
if map.get_parent(l).supports_bikes() {
starting_biking_lanes.push(l);
}
}
if !starting_biking_lanes.is_empty() {
for _ in 0..s.num_bikes {
let spawn_time = Tick::uniform(s.start_tick, s.stop_tick, &mut sim.rng);