From 7b6f0cefb9946f4eb7ce435a250366b19093b9a0 Mon Sep 17 00:00:00 2001 From: Petr Mikheev Date: Sat, 22 Apr 2023 17:07:54 +0200 Subject: [PATCH] Fix regressions in ESM4 reader caused by !2902 --- components/esm4/loadland.cpp | 2 +- components/esm4/loadland.hpp | 4 ++-- components/esm4/loadpgrd.cpp | 2 +- components/esm4/loadqust.cpp | 2 +- components/esm4/loadrace.cpp | 14 +++++++------- components/esm4/loadwrld.cpp | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/components/esm4/loadland.cpp b/components/esm4/loadland.cpp index 732b46f00a..ccbfe66f44 100644 --- a/components/esm4/loadland.cpp +++ b/components/esm4/loadland.cpp @@ -213,7 +213,7 @@ void ESM4::Land::load(ESM4::Reader& reader) bool missing = false; for (int i = 0; i < 4; ++i) { - if (mTextures[i].base.formId.isZeroOrUnset()) + if (mTextures[i].base.formId == 0) { // std::cout << "ESM4::LAND " << ESM4::formIdToString(mFormId) << " missing base, quad " << i << std::endl; // std::cout << "layers " << mTextures[i].layers.size() << std::endl; diff --git a/components/esm4/loadland.hpp b/components/esm4/loadland.hpp index 12de4aee31..9c5e21b9bc 100644 --- a/components/esm4/loadland.hpp +++ b/components/esm4/loadland.hpp @@ -74,7 +74,7 @@ namespace ESM4 struct BTXT { - FormId formId; + FormId32 formId; std::uint8_t quadrant; // 0 = bottom left, 1 = bottom right, 2 = top left, 3 = top right std::uint8_t unknown1; std::uint16_t unknown2; @@ -82,7 +82,7 @@ namespace ESM4 struct ATXT { - FormId formId; + FormId32 formId; std::uint8_t quadrant; // 0 = bottom left, 1 = bottom right, 2 = top left, 3 = top right std::uint8_t unknown; std::uint16_t layerIndex; // texture layer, 0..7 diff --git a/components/esm4/loadpgrd.cpp b/components/esm4/loadpgrd.cpp index 19b6df822a..bcbea07297 100644 --- a/components/esm4/loadpgrd.cpp +++ b/components/esm4/loadpgrd.cpp @@ -109,7 +109,7 @@ void ESM4::Pathgrid::load(ESM4::Reader& reader) case ESM4::SUB_PGRL: { static PGRL objLink; - reader.get(objLink.object); + reader.getFormId(objLink.object); // object linkedNode std::size_t numNodes = (subHdr.dataSize - sizeof(int32_t)) / sizeof(int32_t); diff --git a/components/esm4/loadqust.cpp b/components/esm4/loadqust.cpp index fe0e63e979..f1f3876d3e 100644 --- a/components/esm4/loadqust.cpp +++ b/components/esm4/loadqust.cpp @@ -69,7 +69,7 @@ void ESM4::Quest::load(ESM4::Reader& reader) break; } case ESM4::SUB_SCRI: - reader.get(mQuestScript); + reader.getFormId(mQuestScript); break; case ESM4::SUB_CTDA: // FIXME: how to detect if 1st/2nd param is a formid? { diff --git a/components/esm4/loadrace.cpp b/components/esm4/loadrace.cpp index ae0af2cd4f..04f3bd0fc2 100644 --- a/components/esm4/loadrace.cpp +++ b/components/esm4/loadrace.cpp @@ -223,8 +223,8 @@ void ESM4::Race::load(ESM4::Reader& reader) } case ESM4::SUB_DNAM: { - reader.get(mDefaultHair[0]); // male - reader.get(mDefaultHair[1]); // female + reader.getFormId(mDefaultHair[0]); // male + reader.getFormId(mDefaultHair[1]); // female break; } @@ -421,7 +421,7 @@ void ESM4::Race::load(ESM4::Reader& reader) std::size_t numHairChoices = subHdr.dataSize / sizeof(FormId32); mHairChoices.resize(numHairChoices); for (unsigned int i = 0; i < numHairChoices; ++i) - reader.get(mHairChoices.at(i)); + reader.getFormId(mHairChoices.at(i)); break; } @@ -430,7 +430,7 @@ void ESM4::Race::load(ESM4::Reader& reader) std::size_t numEyeChoices = subHdr.dataSize / sizeof(FormId32); mEyeChoices.resize(numEyeChoices); for (unsigned int i = 0; i < numEyeChoices; ++i) - reader.get(mEyeChoices.at(i)); + reader.getFormId(mEyeChoices.at(i)); break; } @@ -495,7 +495,7 @@ void ESM4::Race::load(ESM4::Reader& reader) { FormId race; std::int32_t adjustment; - reader.get(race); + reader.getFormId(race); reader.get(adjustment); mDisposition[race] = adjustment; @@ -505,8 +505,8 @@ void ESM4::Race::load(ESM4::Reader& reader) { if (subHdr.dataSize == 8) // TES4 { - reader.get(mVNAM[0]); // For TES4 seems to be 2 race formids - reader.get(mVNAM[1]); + reader.getFormId(mVNAM[0]); // For TES4 seems to be 2 race formids + reader.getFormId(mVNAM[1]); } else if (subHdr.dataSize == 4) // TES5 { diff --git a/components/esm4/loadwrld.cpp b/components/esm4/loadwrld.cpp index dd80b6aaf7..f421a8e7ff 100644 --- a/components/esm4/loadwrld.cpp +++ b/components/esm4/loadwrld.cpp @@ -79,7 +79,7 @@ void ESM4::World::load(ESM4::Reader& reader) reader.getZString(mMapFile); break; // map filename, Oblivion only? case ESM4::SUB_CNAM: - reader.get(mClimate); + reader.getFormId(mClimate); break; case ESM4::SUB_NAM2: reader.getFormId(mWater);