From 679a74138d2544562310ef94e2ad80a15189588f Mon Sep 17 00:00:00 2001 From: Lyuu17 Date: Thu, 4 Jul 2024 17:07:55 +0200 Subject: [PATCH] Load nested DATA in ConfigReader --- src/SWBF2/Native/Chunks/ConfigReader.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/SWBF2/Native/Chunks/ConfigReader.cpp b/src/SWBF2/Native/Chunks/ConfigReader.cpp index 5627fc8..b3f9b91 100644 --- a/src/SWBF2/Native/Chunks/ConfigReader.cpp +++ b/src/SWBF2/Native/Chunks/ConfigReader.cpp @@ -49,10 +49,19 @@ namespace SWBF2::Native *dataReaderChild >> node.m_string; } - auto scopReaderChild = streamReader.ReadChildWithHeader<"SCOP"_m>(); + if (streamReader.IsNextHeader<"SCOP"_m>()) { + auto scopReaderChild = streamReader.ReadChildWithHeader<"SCOP"_m>(); ReadDataScop(*scopReaderChild, node); } + else if (streamReader.IsNextHeader<"DATA"_m>()) + { + ReadDataScop(streamReader, node); + } + else + { + throw std::runtime_error{ "unexpected header" }; + } } }