handle items
This commit is contained in:
parent
ac692d05a3
commit
b0defa6f73
16
src/main.rs
16
src/main.rs
|
@ -659,14 +659,12 @@ fn room_from_string(string: String) -> Room {
|
||||||
palette = last_line.replace("PAL ", "").to_string();
|
palette = last_line.replace("PAL ", "").to_string();
|
||||||
} else if last_line.starts_with("ITM") {
|
} else if last_line.starts_with("ITM") {
|
||||||
let last_line = last_line.replace("ITM ", "");
|
let last_line = last_line.replace("ITM ", "");
|
||||||
let item_pos: Vec<&str> = last_line.split(' ').collect();
|
let item_position: Vec<&str> = last_line.split(' ').collect();
|
||||||
let item_id = item_pos[0];
|
let item_id = item_position[0];
|
||||||
let pos = item_pos[1];
|
let position = item_position[1];
|
||||||
|
let position = position_from_string(position.to_string());
|
||||||
|
|
||||||
items.insert(
|
items.insert(position, item_id.to_string());
|
||||||
position_from_string(pos.to_string()),
|
|
||||||
item_id.to_string()
|
|
||||||
);
|
|
||||||
} else if last_line.starts_with("EXT") {
|
} else if last_line.starts_with("EXT") {
|
||||||
let last_line = last_line.replace("EXT ", "");
|
let last_line = last_line.replace("EXT ", "");
|
||||||
let parts: Vec<&str> = last_line.split(' ').collect();
|
let parts: Vec<&str> = last_line.split(' ').collect();
|
||||||
|
@ -686,7 +684,7 @@ fn room_from_string(string: String) -> Room {
|
||||||
palette,
|
palette,
|
||||||
name,
|
name,
|
||||||
tiles: vec![],
|
tiles: vec![],
|
||||||
items: Default::default(),
|
items,
|
||||||
exits,
|
exits,
|
||||||
endings: Default::default()
|
endings: Default::default()
|
||||||
}
|
}
|
||||||
|
@ -705,5 +703,5 @@ fn room_from_string(string: String) -> Room {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("why am I here?")
|
println!("why does a crate need a main function?")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue