fix sprite_to_string()

This commit is contained in:
Max Bradbury 2020-04-10 16:52:53 +01:00
parent eb7f33633f
commit 3e98f3acba
1 changed files with 2 additions and 2 deletions

View File

@ -561,18 +561,18 @@ fn test_sprite_from_string() {
fn sprite_to_string(sprite: Sprite) -> String { fn sprite_to_string(sprite: Sprite) -> String {
format!( format!(
"SPR {}\n{}{}{}\nPOS {}", "SPR {}\n{}{}{}\nPOS {} {}",
sprite.id, sprite.id,
animation_frames_to_string(sprite.animation_frames), animation_frames_to_string(sprite.animation_frames),
if sprite.name.is_some() {format!("\nNAME {}", sprite.name.unwrap())} else {"".to_string()}, if sprite.name.is_some() {format!("\nNAME {}", sprite.name.unwrap())} else {"".to_string()},
if sprite.dialogue.is_some() {format!("\nDLG {}", sprite.dialogue.unwrap())} else {"".to_string()}, if sprite.dialogue.is_some() {format!("\nDLG {}", sprite.dialogue.unwrap())} else {"".to_string()},
sprite.room,
position_to_string(sprite.position), position_to_string(sprite.position),
) )
} }
#[test] #[test]
fn test_sprite_to_string() { fn test_sprite_to_string() {
// todo this fails
let output = sprite_to_string(test_sprite()); let output = sprite_to_string(test_sprite());
let expected = "SPR a\n00000000\n01111000\n01001000\n00111100\n00111100\n01011110\n01011110\n01101111\nNAME hatch\nDLG SPR_0\nPOS 4 9,7".to_string(); let expected = "SPR a\n00000000\n01111000\n01001000\n00111100\n00111100\n01011110\n01011110\n01101111\nNAME hatch\nDLG SPR_0\nPOS 4 9,7".to_string();