From 9830d57d1326ce445ed5f7b99f0f9f207d3515ae Mon Sep 17 00:00:00 2001 From: Max Bradbury Date: Mon, 6 Apr 2020 20:41:33 +0100 Subject: [PATCH] handle room tiles --- src/main.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index f8eb1a3..c9b938a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -747,15 +747,19 @@ fn room_from_string(string: String) -> Room { } } - Room { - id, - palette, - name, - tiles: vec![], - items, - exits, - endings + let lines = lines; + + let mut tiles : Vec = Vec::new(); + + for line in lines.into_iter() { + let line: Vec<&str> = line.split(",").collect(); + + for tile_id in line { + tiles.push(tile_id.to_string()); + } } + + Room { id, palette, name, tiles, items, exits, endings } } // fn game_from_string(game: String ) -> Game {