Restore original formId

To make sure esmtool prints original value and not a result of conversion.
7220-lua-add-a-general-purpose-lexical-parser
elsid 2 years ago
parent b12507f808
commit 5bb088218e
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -71,17 +71,17 @@ namespace EsmTool
constexpr bool hasFormId = HasFormId<T>::value;
template <class T, class = std::void_t<>>
struct HasRefId : std::false_type
struct HasId : std::false_type
{
};
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>
constexpr bool hasRefId = HasRefId<T>::value;
constexpr bool hasId = HasId<T>::value;
template <class T, class = std::void_t<>>
struct HasFlags : std::false_type
@ -183,8 +183,8 @@ namespace EsmTool
std::cout << "\n Record: " << ESM::NAME(reader.hdr().record.typeId).toStringView();
if constexpr (hasFormId<T>)
std::cout << "\n FormId: " << value.mFormId;
if constexpr (hasRefId<T>)
std::cout << "\n FormId: " << value.mId;
if constexpr (hasId<T>)
std::cout << "\n Id: " << value.mId;
if constexpr (hasFlags<T>)
std::cout << "\n Record flags: " << recordFlags(value.mFlags);
if constexpr (hasEditorId<T>)

@ -49,9 +49,9 @@
// longer/shorter/same as loading the subrecords.
void ESM4::Cell::load(ESM4::Reader& reader)
{
auto formId = reader.hdr().record.id;
reader.adjustFormId(formId);
mId = ESM::RefId::formIdRefId(formId);
mFormId = reader.hdr().record.id;
reader.adjustFormId(mFormId);
mId = ESM::RefId::formIdRefId(mFormId);
mFlags = reader.hdr().record.flags;
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
// cell child groups if we are loading them after restoring the context
// (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();
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.
struct Cell
{
FormId mParent; // world formId (for grouping cells), from the loading sequence
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
FormId mParent; // world formId (for grouping cells), from the loading sequence
std::string mEditorId;
std::string mFullName;
std::uint16_t mCellFlags; // TES5 can also be 8 bits

@ -34,11 +34,12 @@
void ESM4::Reference::load(ESM4::Reader& reader)
{
auto formId = reader.hdr().record.id;
reader.adjustFormId(formId);
mId = ESM::RefId::formIdRefId(formId);
mFormId = reader.hdr().record.id;
reader.adjustFormId(mFormId);
mId = ESM::RefId::formIdRefId(mFormId);
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?
// mInitiallyDisabled = ((mFlags & ESM4::Rec_Disabled) != 0) ? true : false;

@ -74,10 +74,13 @@ namespace ESM4
struct Reference
{
ESM::RefId mParent; // cell FormId (currently persistent refs only), from the loading sequence
// NOTE: for exterior cells it will be the dummy cell FormId
FormId mFormId; // from the header
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::string mEditorId;

@ -34,9 +34,9 @@
void ESM4::Static::load(ESM4::Reader& reader)
{
FormId formId = reader.hdr().record.id;
reader.adjustFormId(formId);
mId = ESM::RefId::formIdRefId(formId);
mFormId = reader.hdr().record.id;
reader.adjustFormId(mFormId);
mId = ESM::RefId::formIdRefId(mFormId);
mFlags = reader.hdr().record.flags;
while (reader.getSubRecordHeader())

@ -43,7 +43,9 @@ namespace ESM4
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::string mEditorId;

Loading…
Cancel
Save