1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Print ESM4 EditorId and Model by esmtool dump

This commit is contained in:
elsid 2022-09-12 01:33:13 +02:00
parent 4f7dcd5ae5
commit a9826342b2
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

View File

@ -62,6 +62,24 @@ namespace EsmTool
template <class T> template <class T>
constexpr bool hasFlags = HasFlags<T>::value; constexpr bool hasFlags = HasFlags<T>::value;
template <class T, class = std::void_t<>>
struct HasEditorId : std::false_type {};
template <class T>
struct HasEditorId<T, std::void_t<decltype(T::mEditorId)>> : std::true_type {};
template <class T>
constexpr bool hasEditorId = HasEditorId<T>::value;
template <class T, class = std::void_t<>>
struct HasModel : std::false_type {};
template <class T>
struct HasModel<T, std::void_t<decltype(T::mModel)>> : std::true_type {};
template <class T>
constexpr bool hasModel = HasModel<T>::value;
template <class T> template <class T>
void readTypedRecord(const Params& params, ESM4::Reader& reader) void readTypedRecord(const Params& params, ESM4::Reader& reader)
{ {
@ -75,9 +93,13 @@ namespace EsmTool
std::cout << "\n Record: " << ESM::NAME(reader.hdr().record.typeId).toStringView(); std::cout << "\n Record: " << ESM::NAME(reader.hdr().record.typeId).toStringView();
if constexpr (hasFormId<T>) if constexpr (hasFormId<T>)
std::cout << ' ' << value.mFormId; std::cout << "\n FormId: " << value.mFormId;
if constexpr (hasFlags<T>) if constexpr (hasFlags<T>)
std::cout << "\n Record flags: " << recordFlags(value.mFlags); std::cout << "\n Record flags: " << recordFlags(value.mFlags);
if constexpr (hasEditorId<T>)
std::cout << "\n EditorId: " << value.mEditorId;
if constexpr (hasModel<T>)
std::cout << "\n Model: " << value.mModel;
std::cout << '\n'; std::cout << '\n';
} }