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)]
|
#![warn(variant_size_differences)]
|
||||||
|
|
||||||
pub mod world;
|
pub mod world;
|
||||||
pub use world::*;
|
pub use world::{TerrainCell, World, WorldGenError};
|
||||||
pub mod biome;
|
pub mod biome;
|
||||||
pub use biome::*;
|
pub use biome::{BiomeStats, BiomeType};
|
||||||
pub mod world_manager;
|
pub mod world_manager;
|
||||||
pub use world_manager::WorldManager;
|
pub use world_manager::WorldManager;
|
||||||
pub(crate) mod macros;
|
pub(crate) mod macros;
|
||||||
|
|
|
@ -269,18 +269,23 @@ fn handle_toolbar_button(
|
||||||
ToolbarButton::SaveWorld => {
|
ToolbarButton::SaveWorld => {
|
||||||
#[cfg(feature = "logging")]
|
#[cfg(feature = "logging")]
|
||||||
debug!("Saving world");
|
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 => {
|
ToolbarButton::LoadWorld => {
|
||||||
#[cfg(feature = "logging")]
|
#[cfg(feature = "logging")]
|
||||||
debug!("Loading world");
|
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(
|
refresh_map_texture(
|
||||||
&mut images,
|
&mut images,
|
||||||
#[cfg(feature = "globe_view")]
|
#[cfg(feature = "globe_view")]
|
||||||
&mut materials,
|
&mut materials,
|
||||||
&world_manager,
|
&world_manager,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
#[cfg(feature = "globe_view")]
|
#[cfg(feature = "globe_view")]
|
||||||
ToolbarButton::GlobeView => {
|
ToolbarButton::GlobeView => {
|
||||||
|
|
Loading…
Reference in a new issue