From 037f610865386350631b9e7c361a22887dad69fd Mon Sep 17 00:00:00 2001 From: yuni Date: Wed, 30 Oct 2024 18:53:02 +0100 Subject: [PATCH] add error message when a scene is undefined --- src/cmd.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/cmd.rs b/src/cmd.rs index e63eac0..c7fac85 100644 --- a/src/cmd.rs +++ b/src/cmd.rs @@ -748,6 +748,11 @@ fn spawn_scenes( for state_wrapper in er_spawnscene.read() { let root_state = &state_wrapper.0; + let mut found = false; + let scene_name = root_state + .name + .clone() + .unwrap_or_else(|| String::from("ERROR_NO_SCENE_NAME")); let scene_defs = include!("data/scenes.in"); for (name, template, pos, rot) in scene_defs { let pos = DVec3::new( @@ -755,7 +760,8 @@ fn spawn_scenes( root_state.pos[1] + pos[2], root_state.pos[2] - pos[1], ); - if Some(name.to_string()) == root_state.name { + if name == scene_name { + found = true; let mut state = ParserState::default(); state.class = DefClass::Actor; state.pos = pos; @@ -902,6 +908,9 @@ fn spawn_scenes( } } } + if !found { + error!("Undefined scene `{}'", scene_name); + } } }