Download city.bin if needed

This commit is contained in:
Dustin Carlino 2021-04-20 16:18:21 -07:00
parent 7004cd7af2
commit 4212b200d1
2 changed files with 18 additions and 1 deletions

View File

@ -447,6 +447,23 @@ impl<A: AppLike + 'static> State<A> for CitiesInCountryPicker<A> {
if maps.len() == 1 { if maps.len() == 1 {
return chose_city(ctx, app, maps.pop().unwrap(), &mut self.on_load); return chose_city(ctx, app, maps.pop().unwrap(), &mut self.on_load);
} }
// We may need to grab city.bin
#[cfg(not(target_arch = "wasm32"))]
{
let path = format!("system/{}/{}/city.bin", city.country, city.city);
if Manifest::load()
.entries
.contains_key(&format!("data/{}", path))
&& !abstio::file_exists(abstio::path(path))
{
return crate::tools::prompt_to_download_missing_data(
ctx,
maps.pop().unwrap(),
);
}
}
return Transition::Replace(CityPicker::new_in_city( return Transition::Replace(CityPicker::new_in_city(
ctx, ctx,
self.on_load.take().unwrap(), self.on_load.take().unwrap(),

View File

@ -63,7 +63,7 @@ async fn download_updates(version: String, minimal: bool) {
if local.entries.get(&path).map(|x| &x.checksum) != Some(&entry.checksum) { if local.entries.get(&path).map(|x| &x.checksum) != Some(&entry.checksum) {
// For the Github Actions build, only include a few files to get started. The UI will // For the Github Actions build, only include a few files to get started. The UI will
// download more data when the player tries to open another map. // download more data when the player tries to open another map.
if minimal && !path.contains("montlake") { if minimal && !path.contains("montlake") && path != "data/system/us/seattle/city.bin" {
continue; continue;
} }