mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-11 13:25:53 -04:00
Restore original formId
To make sure esmtool prints original value and not a result of conversion.
This commit is contained in:
parent
b12507f808
commit
5bb088218e
@ -71,17 +71,17 @@ namespace EsmTool
|
|||||||
constexpr bool hasFormId = HasFormId<T>::value;
|
constexpr bool hasFormId = HasFormId<T>::value;
|
||||||
|
|
||||||
template <class T, class = std::void_t<>>
|
template <class T, class = std::void_t<>>
|
||||||
struct HasRefId : std::false_type
|
struct HasId : std::false_type
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct HasRefId<T, std::void_t<decltype(T::mId)>> : std::true_type
|
struct HasId<T, std::void_t<decltype(T::mId)>> : std::true_type
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
constexpr bool hasRefId = HasRefId<T>::value;
|
constexpr bool hasId = HasId<T>::value;
|
||||||
|
|
||||||
template <class T, class = std::void_t<>>
|
template <class T, class = std::void_t<>>
|
||||||
struct HasFlags : std::false_type
|
struct HasFlags : std::false_type
|
||||||
@ -183,8 +183,8 @@ 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 << "\n FormId: " << value.mFormId;
|
std::cout << "\n FormId: " << value.mFormId;
|
||||||
if constexpr (hasRefId<T>)
|
if constexpr (hasId<T>)
|
||||||
std::cout << "\n FormId: " << value.mId;
|
std::cout << "\n Id: " << value.mId;
|
||||||
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>)
|
if constexpr (hasEditorId<T>)
|
||||||
|
@ -49,9 +49,9 @@
|
|||||||
// longer/shorter/same as loading the subrecords.
|
// longer/shorter/same as loading the subrecords.
|
||||||
void ESM4::Cell::load(ESM4::Reader& reader)
|
void ESM4::Cell::load(ESM4::Reader& reader)
|
||||||
{
|
{
|
||||||
auto formId = reader.hdr().record.id;
|
mFormId = reader.hdr().record.id;
|
||||||
reader.adjustFormId(formId);
|
reader.adjustFormId(mFormId);
|
||||||
mId = ESM::RefId::formIdRefId(formId);
|
mId = ESM::RefId::formIdRefId(mFormId);
|
||||||
mFlags = reader.hdr().record.flags;
|
mFlags = reader.hdr().record.flags;
|
||||||
mParent = reader.currWorld();
|
mParent = reader.currWorld();
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ void ESM4::Cell::load(ESM4::Reader& reader)
|
|||||||
// WARN: we need to call setCurrCell (and maybe setCurrCellGrid?) again before loading
|
// WARN: we need to call setCurrCell (and maybe setCurrCellGrid?) again before loading
|
||||||
// cell child groups if we are loading them after restoring the context
|
// cell child groups if we are loading them after restoring the context
|
||||||
// (may be easier to update the context before saving?)
|
// (may be easier to update the context before saving?)
|
||||||
reader.setCurrCell(formId); // save for LAND (and other children) to access later
|
reader.setCurrCell(mFormId); // save for LAND (and other children) to access later
|
||||||
std::uint32_t esmVer = reader.esmVersion();
|
std::uint32_t esmVer = reader.esmVersion();
|
||||||
bool isFONV = esmVer == ESM::VER_132 || esmVer == ESM::VER_133 || esmVer == ESM::VER_134;
|
bool isFONV = esmVer == ESM::VER_132 || esmVer == ESM::VER_133 || esmVer == ESM::VER_134;
|
||||||
|
|
||||||
|
@ -62,11 +62,12 @@ namespace ESM4
|
|||||||
// The cells need to be organised under world spaces.
|
// The cells need to be organised under world spaces.
|
||||||
struct Cell
|
struct Cell
|
||||||
{
|
{
|
||||||
FormId mParent; // world formId (for grouping cells), from the loading sequence
|
FormId mFormId; // from the header
|
||||||
|
ESM::RefId mId;
|
||||||
ESM::RefId mId; // 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
|
||||||
|
|
||||||
|
FormId mParent; // world formId (for grouping cells), from the loading sequence
|
||||||
|
|
||||||
std::string mEditorId;
|
std::string mEditorId;
|
||||||
std::string mFullName;
|
std::string mFullName;
|
||||||
std::uint16_t mCellFlags; // TES5 can also be 8 bits
|
std::uint16_t mCellFlags; // TES5 can also be 8 bits
|
||||||
|
@ -34,11 +34,12 @@
|
|||||||
|
|
||||||
void ESM4::Reference::load(ESM4::Reader& reader)
|
void ESM4::Reference::load(ESM4::Reader& reader)
|
||||||
{
|
{
|
||||||
auto formId = reader.hdr().record.id;
|
mFormId = reader.hdr().record.id;
|
||||||
reader.adjustFormId(formId);
|
reader.adjustFormId(mFormId);
|
||||||
mId = ESM::RefId::formIdRefId(formId);
|
mId = ESM::RefId::formIdRefId(mFormId);
|
||||||
mFlags = reader.hdr().record.flags;
|
mFlags = reader.hdr().record.flags;
|
||||||
mParent = ESM::RefId::formIdRefId(reader.currCell()); // NOTE: only for persistent refs?
|
mParentFormId = reader.currCell(); // NOTE: only for persistent refs?
|
||||||
|
mParent = ESM::RefId::formIdRefId(mParentFormId);
|
||||||
|
|
||||||
// TODO: Let the engine apply this? Saved games?
|
// TODO: Let the engine apply this? Saved games?
|
||||||
// mInitiallyDisabled = ((mFlags & ESM4::Rec_Disabled) != 0) ? true : false;
|
// mInitiallyDisabled = ((mFlags & ESM4::Rec_Disabled) != 0) ? true : false;
|
||||||
|
@ -74,10 +74,13 @@ namespace ESM4
|
|||||||
|
|
||||||
struct Reference
|
struct Reference
|
||||||
{
|
{
|
||||||
ESM::RefId mParent; // cell FormId (currently persistent refs only), from the loading sequence
|
FormId mFormId; // from the header
|
||||||
// NOTE: for exterior cells it will be the dummy cell FormId
|
ESM::RefId mId;
|
||||||
|
|
||||||
|
FormId mParentFormId; // cell FormId (currently persistent refs only), from the loading sequence
|
||||||
|
// NOTE: for exterior cells it will be the dummy cell FormId
|
||||||
|
ESM::RefId mParent;
|
||||||
|
|
||||||
ESM::RefId mId; // 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
|
||||||
|
|
||||||
std::string mEditorId;
|
std::string mEditorId;
|
||||||
|
@ -34,9 +34,9 @@
|
|||||||
|
|
||||||
void ESM4::Static::load(ESM4::Reader& reader)
|
void ESM4::Static::load(ESM4::Reader& reader)
|
||||||
{
|
{
|
||||||
FormId formId = reader.hdr().record.id;
|
mFormId = reader.hdr().record.id;
|
||||||
reader.adjustFormId(formId);
|
reader.adjustFormId(mFormId);
|
||||||
mId = ESM::RefId::formIdRefId(formId);
|
mId = ESM::RefId::formIdRefId(mFormId);
|
||||||
mFlags = reader.hdr().record.flags;
|
mFlags = reader.hdr().record.flags;
|
||||||
|
|
||||||
while (reader.getSubRecordHeader())
|
while (reader.getSubRecordHeader())
|
||||||
|
@ -43,7 +43,9 @@ namespace ESM4
|
|||||||
|
|
||||||
struct Static
|
struct Static
|
||||||
{
|
{
|
||||||
ESM::RefId mId; // from the header
|
FormId mFormId; // from the header
|
||||||
|
ESM::RefId mId;
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
std::string mEditorId;
|
std::string mEditorId;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user