From a0d109c0b8f5a062bf3bcb904397fb19f6cca2cb Mon Sep 17 00:00:00 2001 From: Max Bradbury Date: Fri, 24 Apr 2020 18:08:21 +0100 Subject: [PATCH] handle optional game version and room format; transform line endings --- src/game.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/game.rs b/src/game.rs index cd1fe81..704af34 100644 --- a/src/game.rs +++ b/src/game.rs @@ -295,14 +295,17 @@ impl ToString for Game { segments.push(self.font_data.to_owned().unwrap()) } - format!( - "{}\n{}\n{}{}{}\n\n{}\n\n", - &self.name, - &self.version_line(), - &self.room_format_line(), - &self.font_line(), - &self.text_direction_line(), - segments.join("\n\n"), + transform_line_endings( + format!( + "{}{}{}{}{}\n\n{}\n\n", + &self.name, + &self.version_line(), + &self.room_format_line(), + &self.font_line(), + &self.text_direction_line(), + segments.join("\n\n"), + ), + if self.line_endings_crlf {TransformMode::CRLF} else {TransformMode::LF} ) } }