use ready-made function for splitting lines
This commit is contained in:
parent
ee0ef8bbdf
commit
15eb501999
10
src/main.rs
10
src/main.rs
|
@ -353,7 +353,7 @@ fn animation_frames_to_string(animation_frames: Vec<Image>) -> String {
|
|||
}
|
||||
|
||||
fn tile_from_string(string: String) -> Tile {
|
||||
let mut lines: Vec<&str> = string.split("\n").collect();
|
||||
let mut lines: Vec<&str> = string.lines().collect();
|
||||
|
||||
let id = lines[0].replace("TIL ", "");
|
||||
|
||||
|
@ -589,7 +589,7 @@ fn test_avatar_to_string() {
|
|||
}
|
||||
|
||||
fn sprite_from_string(string: String) -> Sprite {
|
||||
let mut lines: Vec<&str> = string.split("\n").collect();
|
||||
let mut lines: Vec<&str> = string.lines().collect();
|
||||
|
||||
let id = lines[0].replace("SPR ", "");
|
||||
let mut name = None;
|
||||
|
@ -659,7 +659,7 @@ fn test_sprite_to_string() {
|
|||
}
|
||||
|
||||
fn item_from_string(string: String) -> Item {
|
||||
let mut lines: Vec<&str> = string.split("\n").collect();
|
||||
let mut lines: Vec<&str> = string.lines().collect();
|
||||
|
||||
let id = lines[0].replace("ITM ", "");
|
||||
let mut name = None;
|
||||
|
@ -783,7 +783,7 @@ fn test_ending_to_string() {
|
|||
}
|
||||
|
||||
fn dialogue_from_string(string: String) -> Dialogue {
|
||||
let lines: Vec<&str> = string.split("\n").collect();
|
||||
let lines: Vec<&str> = string.lines().collect();
|
||||
let id = lines[0].replace("DLG ", "").to_string();
|
||||
let contents = lines[1..].join("\n");
|
||||
|
||||
|
@ -847,7 +847,7 @@ fn test_variable_to_string() {
|
|||
|
||||
fn room_from_string(string: String) -> Room {
|
||||
// todo handle room_format?
|
||||
let mut lines: Vec<&str> = string.split("\n").collect();
|
||||
let mut lines: Vec<&str> = string.lines().collect();
|
||||
let id = lines[0].replace("ROOM ", "");
|
||||
let mut name = None;
|
||||
let mut palette = "0".to_string();
|
||||
|
|
Loading…
Reference in New Issue