diff --git a/src/main.rs b/src/main.rs index 1f63097..ee6aeec 100644 --- a/src/main.rs +++ b/src/main.rs @@ -640,7 +640,7 @@ fn room_from_string(string: String) -> Room { let mut name = None; let mut palette = "0".to_string(); let mut items: HashMap = HashMap::new(); - let exits: HashMap = HashMap::new(); + let mut exits: HashMap = HashMap::new(); let endings: HashMap = HashMap::new(); loop { @@ -661,7 +661,12 @@ fn room_from_string(string: String) -> Room { item_id.to_string() ); } else if last_line.starts_with("EXT") { + let last_line = last_line.replace("EXT ", ""); + let parts: Vec<&str> = last_line.split(' ').collect(); + let position = position_from_string(parts[0].to_string()); + let exit = exit_from_string(format!("{} {}", parts[1], parts[2])); + exits.insert(position, exit); } else if last_line.starts_with("END") { } else { @@ -675,7 +680,7 @@ fn room_from_string(string: String) -> Room { name, tiles: vec![], items: Default::default(), - exits: Default::default(), + exits, endings: Default::default() } }