,
- }
-
- let mut sections = Vec::new();
-
- if config_map.is_some() {
+ if let Some(config_map) = config_map {
sections.push(Section {
title: "Game".into(),
lines: Vec::new(),
- config_map,
- info: None,
+ info: Some(SectionInfo::Game(config_map)),
});
} else {
let Ok(pk_file) = File::open(file_paths.pk) else {
@@ -693,7 +692,6 @@ fn handle_relative_connection(
current_section = Section {
title: title.into(),
lines: vec![line],
- config_map: None,
info: None,
};
@@ -710,7 +708,6 @@ fn handle_relative_connection(
sections.push(Section {
title: "Description".into(),
lines: Vec::new(),
- config_map: None,
info: Some(SectionInfo::Description),
});
}
@@ -718,7 +715,6 @@ fn handle_relative_connection(
sections.push(Section {
title: "Comments".into(),
lines: Vec::new(),
- config_map: None,
info: Some(SectionInfo::Comment(comments)),
});
@@ -802,16 +798,7 @@ fn handle_relative_connection(
}
let _ = write!(stream, "");
- for (
- i,
- Section {
- lines,
- config_map,
- info,
- ..
- },
- ) in sections.into_iter().enumerate()
- {
+ for (i, Section { lines, info, .. }) in sections.into_iter().enumerate() {
let index = i + 1;
let _ = write!(stream, r#""#);
if !lines.is_empty() {
@@ -824,25 +811,25 @@ fn handle_relative_connection(
.with_use_textboxes(true),
);
}
- if let Some(config_map) = config_map {
- if render_novel(
- config_map,
- file_paths.pk,
- mlc_path.as_deref(),
- file_paths.mld,
- relative_path,
- &mut stream,
- choice,
- progress,
- )
- .is_err()
- {
- fail(stream);
- return;
- }
- }
if let Some(info) = info {
match info {
+ SectionInfo::Game(config_map) => {
+ if render_novel(
+ config_map,
+ file_paths.pk,
+ mlc_path.as_deref(),
+ file_paths.mld,
+ relative_path,
+ &mut stream,
+ choice,
+ progress,
+ )
+ .is_err()
+ {
+ fail(stream);
+ return;
+ }
+ }
SectionInfo::Description => {
let Ok(pki_file) = File::open(file_paths.pki.unwrap()) else {
unreachable!();