mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Make worldgen panic if loaded map has invalid size
This commit is contained in:
parent
9d67d80a63
commit
fac67a40a1
@ -197,17 +197,12 @@ impl FileOpts {
|
|||||||
fn load_content(&self) -> (Option<ModernMap>, MapSizeLg, f64) {
|
fn load_content(&self) -> (Option<ModernMap>, MapSizeLg, f64) {
|
||||||
let parsed_world_file = self.try_load_map();
|
let parsed_world_file = self.try_load_map();
|
||||||
|
|
||||||
let map_size_lg = parsed_world_file
|
let map_size_lg = if let Some(map) = &parsed_world_file {
|
||||||
.as_ref()
|
MapSizeLg::new(map.map_size_lg)
|
||||||
.and_then(|map| match MapSizeLg::new(map.map_size_lg) {
|
.expect("World size of loaded map does not satisfy invariants.")
|
||||||
Ok(map_size_lg) => Some(map_size_lg),
|
} else {
|
||||||
Err(e) => {
|
self.map_size()
|
||||||
// TODO: this probably should just panic
|
};
|
||||||
warn!("World size of map does not satisfy invariants: {:?}", e);
|
|
||||||
None
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.unwrap_or_else(|| self.map_size());
|
|
||||||
|
|
||||||
// NOTE: Change 1.0 to 4.0 for a 4x
|
// NOTE: Change 1.0 to 4.0 for a 4x
|
||||||
// improvement in world detail. We also use this to automatically adjust
|
// improvement in world detail. We also use this to automatically adjust
|
||||||
|
Loading…
Reference in New Issue
Block a user