Allow GMSTs with empty EDID

revert-6246b479
Alexei Kotov 1 year ago
parent 22cc7f3020
commit 7e1e43f9c6

@ -97,6 +97,11 @@ namespace EsmTool
return stream << " ?"; return stream << " ?";
} }
std::ostream& operator<<(std::ostream& stream, const std::monostate&)
{
return stream << "[none]";
}
std::ostream& operator<<(std::ostream& stream, const WriteData<ESM4::GameSetting::Data>& write) std::ostream& operator<<(std::ostream& stream, const WriteData<ESM4::GameSetting::Data>& write)
{ {
std::visit([&](const auto& v) { stream << v; }, write.mValue); std::visit([&](const auto& v) { stream << v; }, write.mValue);

@ -13,7 +13,10 @@ namespace ESM4
GameSetting::Data readData(FormId formId, std::string_view editorId, Reader& reader) GameSetting::Data readData(FormId formId, std::string_view editorId, Reader& reader)
{ {
if (editorId.empty()) 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]; const char type = editorId[0];
switch (type) switch (type)
{ {

@ -13,7 +13,7 @@ namespace ESM4
struct GameSetting struct GameSetting
{ {
using Data = std::variant<bool, float, std::int32_t, std::string>; using Data = std::variant<std::monostate, bool, float, std::int32_t, std::string>;
FormId mFormId; // from the header FormId mFormId; // from the header
std::uint32_t mFlags; // from the header, see enum type RecordFlag for details std::uint32_t mFlags; // from the header, see enum type RecordFlag for details

Loading…
Cancel
Save