1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-30 08:45:33 +00:00

Dump NIFZ and KFFZ sub records by esmtool

This commit is contained in:
elsid 2022-09-14 23:59:23 +02:00
parent 6f00641c8a
commit 9c291535bb
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625

View file

@ -80,6 +80,45 @@ namespace EsmTool
template <class T>
constexpr bool hasModel = HasModel<T>::value;
template <class T, class = std::void_t<>>
struct HasNif : std::false_type {};
template <class T>
struct HasNif<T, std::void_t<decltype(T::mNif)>> : std::true_type {};
template <class T>
constexpr bool hasNif = HasNif<T>::value;
template <class T, class = std::void_t<>>
struct HasKf : std::false_type {};
template <class T>
struct HasKf<T, std::void_t<decltype(T::mKf)>> : std::true_type {};
template <class T>
constexpr bool hasKf = HasKf<T>::value;
template <class T>
struct WriteArray
{
std::string_view mPrefix;
const T& mValue;
explicit WriteArray(std::string_view prefix, const T& value)
: mPrefix(prefix)
, mValue(value)
{
}
};
template <class T>
std::ostream& operator<<(std::ostream& stream, const WriteArray<T>& write)
{
for (const auto& value : write.mValue)
stream << write.mPrefix << value;
return stream;
}
template <class T>
void readTypedRecord(const Params& params, ESM4::Reader& reader)
{
@ -100,6 +139,10 @@ namespace EsmTool
std::cout << "\n EditorId: " << value.mEditorId;
if constexpr (hasModel<T>)
std::cout << "\n Model: " << value.mModel;
if constexpr (hasNif<T>)
std::cout << "\n Nif:" << WriteArray("\n - ", value.mNif);
if constexpr (hasKf<T>)
std::cout << "\n Kf:" << WriteArray("\n - ", value.mKf);
std::cout << '\n';
}