Handle errors during save/load
This commit is contained in:
parent
4e163b7345
commit
2a1a8855d8
2 changed files with 15 additions and 10 deletions
|
@ -33,9 +33,9 @@
|
|||
#![warn(variant_size_differences)]
|
||||
|
||||
pub mod world;
|
||||
pub use world::*;
|
||||
pub use world::{TerrainCell, World, WorldGenError};
|
||||
pub mod biome;
|
||||
pub use biome::*;
|
||||
pub use biome::{BiomeStats, BiomeType};
|
||||
pub mod world_manager;
|
||||
pub use world_manager::WorldManager;
|
||||
pub(crate) mod macros;
|
||||
|
|
|
@ -269,18 +269,23 @@ fn handle_toolbar_button(
|
|||
ToolbarButton::SaveWorld => {
|
||||
#[cfg(feature = "logging")]
|
||||
debug!("Saving world");
|
||||
_ = world_manager.save_world("planet.ron");
|
||||
if let Err(err) = world_manager.save_world("planet.ron") {
|
||||
eprintln!("Failed to save planet.ron: {}", err);
|
||||
}
|
||||
},
|
||||
ToolbarButton::LoadWorld => {
|
||||
#[cfg(feature = "logging")]
|
||||
debug!("Loading world");
|
||||
_ = world_manager.load_world("planet.ron", &mut images);
|
||||
if let Err(err) = world_manager.load_world("planet.ron", &mut images) {
|
||||
eprintln!("Failed to load planet.ron: {}", err);
|
||||
} else {
|
||||
refresh_map_texture(
|
||||
&mut images,
|
||||
#[cfg(feature = "globe_view")]
|
||||
&mut materials,
|
||||
&world_manager,
|
||||
);
|
||||
}
|
||||
},
|
||||
#[cfg(feature = "globe_view")]
|
||||
ToolbarButton::GlobeView => {
|
||||
|
|
Loading…
Reference in a new issue