From c9bab425a2ac611912528eddc644e81a335c3400 Mon Sep 17 00:00:00 2001 From: Max Bradbury Date: Fri, 24 Apr 2020 18:09:54 +0100 Subject: [PATCH] handle optional version/format lines --- src/game.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/game.rs b/src/game.rs index ce61105..8020442 100644 --- a/src/game.rs +++ b/src/game.rs @@ -346,7 +346,7 @@ impl Game { fn version_line(&self) -> String { if self.version.is_some() { format!( - "\n# BITSY VERSION {}.{}", + "\n\n# BITSY VERSION {}.{}", self.version.as_ref().unwrap().major, self.version.as_ref().unwrap().minor ) } else { @@ -355,7 +355,11 @@ impl Game { } fn room_format_line(&self) -> String { - optional_data_line("! ROOM_FORMAT", Some(self.room_format)) + if self.room_format.is_some() { + format!("\n\n! ROOM_FORMAT {}", self.room_format.unwrap().to_string()) + } else { + "".to_string() + } } fn font_line(&self) -> String {