From 9405714e56885126d5d752d7736c0673a37cab33 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 21 Jun 2025 09:27:12 -0400 Subject: [PATCH] Emit better warnings when loading LGB files Now the "Loading XYZ.lgb" message only shows up *if* we find the file, and if it fails to parse then we tell people to report it to us. See #35 --- src/world/zone.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/world/zone.rs b/src/world/zone.rs index 595a676..6d0d1fe 100644 --- a/src/world/zone.rs +++ b/src/world/zone.rs @@ -39,9 +39,13 @@ impl Zone { let mut load_lgb = |name: &str| -> Option { let path = format!("bg/{}/level/{}.lgb", &bg_path[..level_index], name); + let lgb_file = game_data.extract(&path)?; tracing::info!("Loading {path}"); - let lgb = game_data.extract(&path)?; - LayerGroup::from_existing(&lgb) + let lgb = LayerGroup::from_existing(&lgb_file); + if lgb.is_none() { + tracing::warn!("Failed to parse {path}, this is most likely a bug in Physis and should be reported somewhere!") + } + lgb }; zone.planevent = load_lgb("planevent");