mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-25 15:33:44 +03:00
Remove zones without homes or shops. Found one in London. This can
happen when the overlap with the map is tiny. #556
This commit is contained in:
parent
a7b7638405
commit
9610b69de4
@ -174,6 +174,19 @@ fn create_zones(map: &Map, input: HashMap<String, Polygon>) -> HashMap<String, Z
|
||||
}
|
||||
}
|
||||
|
||||
// Remove empty zones.
|
||||
zones.retain(|name, zone| {
|
||||
if zone.homes.is_empty() {
|
||||
warn!("{} has no homes", name);
|
||||
false
|
||||
} else if zone.workplaces.is_empty() {
|
||||
warn!("{} has no workplaces", name);
|
||||
false
|
||||
} else {
|
||||
true
|
||||
}
|
||||
});
|
||||
|
||||
zones
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user