From 541e20cbec81fc3f927eef2dd8fe2617647ecd2b Mon Sep 17 00:00:00 2001 From: Megamouse Date: Mon, 29 Jun 2020 13:53:39 +0200 Subject: [PATCH] patch_manager: allow Notes as sequence --- Utilities/bin_patch.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/Utilities/bin_patch.cpp b/Utilities/bin_patch.cpp index 4d6e0fcb30..bb5a0d762e 100644 --- a/Utilities/bin_patch.cpp +++ b/Utilities/bin_patch.cpp @@ -292,7 +292,7 @@ bool patch_engine::load(patch_map& patches_map, const std::string& path, bool im if (app_versions.empty()) { append_log_message(log_messages, fmt::format("Error: Skipping %s: empty Sequence (title: %s, patch: %s, key: %s)", serial, title, description, main_key)); - patch_log.error("Skipping %s: empty Sequence (title: %s, patch: %s, key: %s, file: %s)", serial,title, description, main_key, path); + patch_log.error("Skipping %s: empty Sequence (title: %s, patch: %s, key: %s, file: %s)", serial, title, description, main_key, path); is_valid = false; } else @@ -315,7 +315,26 @@ bool patch_engine::load(patch_map& patches_map, const std::string& path, bool im if (const auto notes_node = patches_entry.second["Notes"]) { - info.notes = notes_node.Scalar(); + if (notes_node.IsSequence()) + { + for (const auto note : notes_node) + { + if (note && note.IsScalar()) + { + info.notes += note.Scalar(); + } + else + { + append_log_message(log_messages, fmt::format("Error: Skipping sequenced Note (patch: %s, key: %s)", description, main_key)); + patch_log.error("Skipping sequenced Note (patch: %s, key: %s, file: %s)", description, main_key, path); + is_valid = false; + } + } + } + else + { + info.notes = notes_node.Scalar(); + } } if (const auto patch_group_node = patches_entry.second["Group"])