handle optional version/format lines

This commit is contained in:
Max Bradbury 2020-04-24 18:09:54 +01:00
parent 687cdeaee5
commit c9bab425a2
1 changed files with 6 additions and 2 deletions

View File

@ -346,7 +346,7 @@ impl Game {
fn version_line(&self) -> String { fn version_line(&self) -> String {
if self.version.is_some() { if self.version.is_some() {
format!( format!(
"\n# BITSY VERSION {}.{}", "\n\n# BITSY VERSION {}.{}",
self.version.as_ref().unwrap().major, self.version.as_ref().unwrap().minor self.version.as_ref().unwrap().major, self.version.as_ref().unwrap().minor
) )
} else { } else {
@ -355,7 +355,11 @@ impl Game {
} }
fn room_format_line(&self) -> String { 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 { fn font_line(&self) -> String {