handle exits
This commit is contained in:
parent
b9fecbe8fa
commit
19f01e05d8
|
@ -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<Position, String> = HashMap::new();
|
||||
let exits: HashMap<Position, Exit> = HashMap::new();
|
||||
let mut exits: HashMap<Position, Exit> = HashMap::new();
|
||||
let endings: HashMap<Position, Ending> = 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()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue