From cceff75ba1ccb4e762488fc77f0f330b2a1f33e8 Mon Sep 17 00:00:00 2001 From: TudbuT Date: Sat, 23 Nov 2024 17:15:27 +0100 Subject: [PATCH] fix a compile --- src/game/scene.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/game/scene.rs b/src/game/scene.rs index 4786b79..c61802b 100644 --- a/src/game/scene.rs +++ b/src/game/scene.rs @@ -14,8 +14,19 @@ pub(super) fn scene_plugin(app: &mut App) { app.add_systems(Startup, (import_text_world,)); } -pub(super) fn import_text_world(mut commands: Commands, assets: Res) { - let world_string = fs::read_to_string("assets/world.txt"); - let &[info_string, world_string] = readf("info section\n{}\nworld section\n{}", world_string); - println!() +pub struct WorldInfo { + block_size: f32, +} + +pub(super) fn import_text_world(mut commands: Commands, assets: Res) { + let world_string = fs::read_to_string("assets/world.txt").expect("need a world to load"); + let [info_string, world_string] = &readf("info section\n{}\nworld section\n{}", &world_string) + .expect("world does not have sections")[..] + else { + panic!("world does not have sections"); + }; + + for line in info_string.lines() { + readf("{} = {}", &line); + } }