handle room endings

This commit is contained in:
Max Bradbury 2020-04-06 20:35:01 +01:00
parent d25f7c1026
commit 6e9b91d845
1 changed files with 7 additions and 1 deletions

View File

@ -735,7 +735,13 @@ fn room_from_string(string: String) -> Room {
exits.insert(position, exit);
} else if last_line.starts_with("END") {
let last_line = last_line.replace("END ", "");
let ending_position: Vec<&str> = last_line.split(' ').collect();
let ending= ending_position[0].to_string();
let position = ending_position[1].to_string();
let position = position_from_string(position);
endings.insert(position, ending);
} else {
lines.push(last_line); break;
}
@ -748,7 +754,7 @@ fn room_from_string(string: String) -> Room {
tiles: vec![],
items,
exits,
endings: Default::default()
endings
}
}