diff --git a/apps/esmtool/tes4.cpp b/apps/esmtool/tes4.cpp index 1b85c37c11..533600788e 100644 --- a/apps/esmtool/tes4.cpp +++ b/apps/esmtool/tes4.cpp @@ -71,17 +71,17 @@ namespace EsmTool constexpr bool hasFormId = HasFormId::value; template > - struct HasRefId : std::false_type + struct HasId : std::false_type { }; template - struct HasRefId> : std::true_type + struct HasId> : std::true_type { }; template - constexpr bool hasRefId = HasRefId::value; + constexpr bool hasId = HasId::value; template > 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) std::cout << "\n FormId: " << value.mFormId; - if constexpr (hasRefId) - std::cout << "\n FormId: " << value.mId; + if constexpr (hasId) + std::cout << "\n Id: " << value.mId; if constexpr (hasFlags) std::cout << "\n Record flags: " << recordFlags(value.mFlags); if constexpr (hasEditorId) diff --git a/components/esm4/loadcell.cpp b/components/esm4/loadcell.cpp index 0b829d657f..1b61b746cf 100644 --- a/components/esm4/loadcell.cpp +++ b/components/esm4/loadcell.cpp @@ -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; diff --git a/components/esm4/loadcell.hpp b/components/esm4/loadcell.hpp index 49e5d048b0..96e6c745c9 100644 --- a/components/esm4/loadcell.hpp +++ b/components/esm4/loadcell.hpp @@ -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 diff --git a/components/esm4/loadrefr.cpp b/components/esm4/loadrefr.cpp index b95f24e73a..de6c19c626 100644 --- a/components/esm4/loadrefr.cpp +++ b/components/esm4/loadrefr.cpp @@ -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; diff --git a/components/esm4/loadrefr.hpp b/components/esm4/loadrefr.hpp index fb54c35863..4751336d02 100644 --- a/components/esm4/loadrefr.hpp +++ b/components/esm4/loadrefr.hpp @@ -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; diff --git a/components/esm4/loadstat.cpp b/components/esm4/loadstat.cpp index edfbf0e4e6..c0ab630a13 100644 --- a/components/esm4/loadstat.cpp +++ b/components/esm4/loadstat.cpp @@ -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()) diff --git a/components/esm4/loadstat.hpp b/components/esm4/loadstat.hpp index 3b8a78d8fb..00f4d08c49 100644 --- a/components/esm4/loadstat.hpp +++ b/components/esm4/loadstat.hpp @@ -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;