From 7e1e43f9c687a94a5cd0cf578b72a91aa83ab46a Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Mon, 17 Jul 2023 20:49:02 +0300 Subject: [PATCH] Allow GMSTs with empty EDID --- apps/esmtool/tes4.cpp | 5 +++++ components/esm4/loadgmst.cpp | 5 ++++- components/esm4/loadgmst.hpp | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/esmtool/tes4.cpp b/apps/esmtool/tes4.cpp index 8eaf1b3464..11c3249d44 100644 --- a/apps/esmtool/tes4.cpp +++ b/apps/esmtool/tes4.cpp @@ -97,6 +97,11 @@ namespace EsmTool return stream << " ?"; } + std::ostream& operator<<(std::ostream& stream, const std::monostate&) + { + return stream << "[none]"; + } + std::ostream& operator<<(std::ostream& stream, const WriteData& write) { std::visit([&](const auto& v) { stream << v; }, write.mValue); diff --git a/components/esm4/loadgmst.cpp b/components/esm4/loadgmst.cpp index f7185dc2fd..d58c6d3d87 100644 --- a/components/esm4/loadgmst.cpp +++ b/components/esm4/loadgmst.cpp @@ -13,7 +13,10 @@ namespace ESM4 GameSetting::Data readData(FormId formId, std::string_view editorId, Reader& reader) { if (editorId.empty()) - throw std::runtime_error("Unknown ESM4 GMST (" + formId.toString() + ") data type: editor id is empty"); + { + reader.skipSubRecordData(); + return std::monostate{}; + } const char type = editorId[0]; switch (type) { diff --git a/components/esm4/loadgmst.hpp b/components/esm4/loadgmst.hpp index 552e8e6395..68095404a3 100644 --- a/components/esm4/loadgmst.hpp +++ b/components/esm4/loadgmst.hpp @@ -13,7 +13,7 @@ namespace ESM4 struct GameSetting { - using Data = std::variant; + using Data = std::variant; FormId mFormId; // from the header std::uint32_t mFlags; // from the header, see enum type RecordFlag for details