mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-24 06:55:40 +03:00
Fix huge_seattle data pack issue introduced a few commits ago
This commit is contained in:
parent
ee78644089
commit
a2f08dcc52
@ -54,16 +54,16 @@ impl Manifest {
|
||||
}
|
||||
|
||||
let parts = path.split("/").collect::<Vec<_>>();
|
||||
let mut city = format!("{}/{}", parts[2], parts[3]);
|
||||
let mut data_pack = format!("{}/{}", parts[2], parts[3]);
|
||||
if Manifest::is_file_part_of_huge_seattle(path) {
|
||||
city = "us/huge_seattle".to_string();
|
||||
data_pack = "us/huge_seattle".to_string();
|
||||
}
|
||||
if parts[1] == "input" {
|
||||
if data_packs.input.contains(&city) {
|
||||
if data_packs.input.contains(&data_pack) {
|
||||
continue;
|
||||
}
|
||||
} else if parts[1] == "system" {
|
||||
if data_packs.runtime.contains(&city) {
|
||||
if data_packs.runtime.contains(&data_pack) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
@ -82,7 +82,10 @@ impl Manifest {
|
||||
/// "us/huge_seattle" pack has the rest. This returns true for files belonging to
|
||||
/// "us/huge_seattle".
|
||||
pub fn is_file_part_of_huge_seattle(path: &str) -> bool {
|
||||
let path = path.strip_prefix(&crate::path("")).unwrap_or(path);
|
||||
let path = path
|
||||
.strip_prefix(&crate::path(""))
|
||||
.or_else(|| path.strip_prefix("data/"))
|
||||
.unwrap_or_else(|| path);
|
||||
let name = if let Some(x) = path.strip_prefix("system/us/seattle/maps/") {
|
||||
x.strip_suffix(".bin").unwrap()
|
||||
} else if let Some(x) = path.strip_prefix("system/us/seattle/scenarios/") {
|
||||
@ -110,11 +113,7 @@ impl Manifest {
|
||||
{
|
||||
return None;
|
||||
}
|
||||
if Manifest::is_file_part_of_huge_seattle(path) {
|
||||
return Some(CityName::new("us", "huge_seattle"));
|
||||
} else {
|
||||
return Some(CityName::new(parts[2], parts[3]));
|
||||
}
|
||||
return Some(CityName::new(parts[2], parts[3]));
|
||||
}
|
||||
None
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ use std::fs::File;
|
||||
|
||||
use futures_channel::mpsc;
|
||||
|
||||
use abstio::{CityName, DataPacks, Manifest, MapName};
|
||||
use abstio::{DataPacks, Manifest, MapName};
|
||||
use widgetry::{EventCtx, Key, Transition};
|
||||
|
||||
use crate::load::FutureLoader;
|
||||
@ -16,13 +16,12 @@ const NEXT_RELEASE: &str = "0.2.41";
|
||||
// For each city, how many total bytes do the runtime files cost to download?
|
||||
|
||||
/// How many bytes to download for a city?
|
||||
fn size_of_city(city: &CityName) -> u64 {
|
||||
fn size_of_city(map: &MapName) -> u64 {
|
||||
let mut data_packs = DataPacks {
|
||||
runtime: BTreeSet::new(),
|
||||
input: BTreeSet::new(),
|
||||
};
|
||||
// TODO huge_seattle breaks here...
|
||||
data_packs.runtime.insert(city.to_path());
|
||||
data_packs.runtime.insert(map.to_data_pack_name());
|
||||
let mut manifest = Manifest::load().filter(data_packs);
|
||||
// Don't download files that already exist
|
||||
abstutil::retain_btreemap(&mut manifest.entries, |path, _| {
|
||||
@ -58,7 +57,7 @@ pub fn prompt_to_download_missing_data<A: AppLike + 'static>(
|
||||
ctx,
|
||||
format!(
|
||||
"Missing data. Download {} for {}?",
|
||||
prettyprint_bytes(size_of_city(&map_name.city)),
|
||||
prettyprint_bytes(size_of_city(&map_name)),
|
||||
map_name.city.describe()
|
||||
),
|
||||
vec![
|
||||
|
Loading…
Reference in New Issue
Block a user