Read ESM::FormId using ESM4::Reader::getFormId

simplify_debugging
elsid 2 years ago
parent 99ed8557bf
commit 010db45a10
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -60,7 +60,7 @@ void ESM4::ActorCharacter::load(ESM4::Reader& reader)
reader.get(mScale);
break;
case ESM4::SUB_XOWN:
reader.get(mOwner);
reader.getFormId(mOwner);
break;
case ESM4::SUB_XESP:
{

@ -65,8 +65,8 @@ void ESM4::ActorCreature::load(ESM4::Reader& reader)
reader.getFormId(mOwner);
break;
case ESM4::SUB_XGLB:
reader.get(mGlobal);
break; // FIXME: formId?
reader.getFormId(mGlobal);
break;
case ESM4::SUB_XRNK:
reader.get(mFactionRank);
break;

@ -177,12 +177,12 @@ void ESM4::Creature::load(ESM4::Reader& reader)
break;
}
case ESM4::SUB_TPLT:
reader.get(mBaseTemplate);
reader.getFormId(mBaseTemplate);
break; // FO3
case ESM4::SUB_PNAM: // FO3/FONV/TES5
{
FormId bodyPart;
reader.get(bodyPart);
reader.getFormId(bodyPart);
mBodyParts.push_back(bodyPart);
break;

@ -53,8 +53,8 @@ void ESM4::IdleAnimation::load(ESM4::Reader& reader)
break;
case ESM4::SUB_ANAM:
{
reader.get(mParent);
reader.get(mPrevious);
reader.getFormId(mParent);
reader.getFormId(mPrevious);
break;
}
case ESM4::SUB_CTDA: // formId

@ -75,8 +75,8 @@ void ESM4::IdleMarker::load(ESM4::Reader& reader)
}
mIdleAnim.resize(mIdleCount);
for (unsigned int i = 0; i < static_cast<unsigned int>(mIdleCount); ++i)
reader.get(mIdleAnim.at(i));
for (FormId& value : mIdleAnim)
reader.getFormId(value);
break;
}
case ESM4::SUB_OBND: // object bounds

@ -53,7 +53,7 @@ void ESM4::MovableStatic::load(ESM4::Reader& reader)
reader.get(mData);
break;
case ESM4::SUB_SNAM:
reader.get(mLoopingSound);
reader.getFormId(mLoopingSound);
break;
case ESM4::SUB_DEST: // destruction data
case ESM4::SUB_OBND: // object bounds

@ -80,7 +80,7 @@ void ESM4::Navigation::NavMeshInfo::load(ESM4::Reader& reader)
{
std::uint32_t count;
reader.get(formId);
reader.getFormId(formId);
reader.get(flags);
reader.get(x);
reader.get(y);
@ -107,10 +107,8 @@ void ESM4::Navigation::NavMeshInfo::load(ESM4::Reader& reader)
{
// std::cout << "NVMI countMerged " << std::dec << count << std::endl;
formIdMerged.resize(count);
for (std::vector<FormId>::iterator it = formIdMerged.begin(); it != formIdMerged.end(); ++it)
{
reader.get(*it);
}
for (FormId& value : formIdMerged)
reader.getFormId(value);
}
reader.get(count); // countPrefMerged;
@ -118,10 +116,8 @@ void ESM4::Navigation::NavMeshInfo::load(ESM4::Reader& reader)
{
// std::cout << "NVMI countPrefMerged " << std::dec << count << std::endl;
formIdPrefMerged.resize(count);
for (std::vector<FormId>::iterator it = formIdPrefMerged.begin(); it != formIdPrefMerged.end(); ++it)
{
reader.get(*it);
}
for (FormId& value : formIdPrefMerged)
reader.getFormId(value);
}
reader.get(count); // countLinkedDoors;
@ -148,7 +144,7 @@ void ESM4::Navigation::NavMeshInfo::load(ESM4::Reader& reader)
reader.get(locationMarker);
reader.get(worldSpaceId);
reader.getFormId(worldSpaceId);
// FLG_Tamriel = 0x0000003c, // grid info follows, possibly Tamriel?
// FLG_Morrowind = 0x01380000, // grid info follows, probably Skywind
if (worldSpaceId == FormId{ 0x3c, 0 } || worldSpaceId == FormId{ 0x380000, 1 })
@ -170,7 +166,7 @@ void ESM4::Navigation::NavMeshInfo::load(ESM4::Reader& reader)
else
{
FormId cellId;
reader.get(cellId);
reader.getFormId(cellId);
cellGrid = cellId;
#if 0
@ -279,14 +275,11 @@ void ESM4::Navigation::load(ESM4::Reader& reader)
reader.get(node);
reader.get(count);
}
if (count)
if (count > 0)
{
preferredPaths.resize(count);
for (std::vector<FormId>::iterator it = preferredPaths.begin(); it != preferredPaths.end();
++it)
{
reader.get(*it);
}
for (FormId& value : preferredPaths)
reader.getFormId(value);
}
mPreferredPaths.push_back(std::make_pair(node, preferredPaths));
#if 0

@ -44,7 +44,7 @@ void ESM4::NavMesh::NVNMstruct::load(ESM4::Reader& reader)
reader.get(unknownNVER);
reader.get(unknownLCTN);
reader.get(worldSpaceId);
reader.getFormId(worldSpaceId);
// FLG_Tamriel = 0x0000003c, // grid info follows, possibly Tamriel?
// FLG_Morrowind = 0x01380000, // grid info follows, probably Skywind
if (worldSpaceId == FormId{ 0x3c, 0 } || worldSpaceId == FormId{ 380000, 1 })
@ -82,7 +82,7 @@ void ESM4::NavMesh::NVNMstruct::load(ESM4::Reader& reader)
else
{
FormId cellId;
reader.get(cellId);
reader.getFormId(cellId);
cellGrid = cellId;
#if 0

@ -161,7 +161,7 @@ void ESM4::Npc::load(ESM4::Reader& reader)
case ESM4::SUB_WNAM:
{
if (reader.esmVersion() == ESM::VER_094 || reader.esmVersion() == ESM::VER_170)
reader.get(mWornArmor);
reader.getFormId(mWornArmor);
else
reader.get(mFootWeight);
break;
@ -192,7 +192,7 @@ void ESM4::Npc::load(ESM4::Reader& reader)
break;
}
case ESM4::SUB_TPLT:
reader.get(mBaseTemplate);
reader.getFormId(mBaseTemplate);
break;
case ESM4::SUB_FGGS:
{

@ -226,6 +226,9 @@ namespace ESM4
mStream->read((char*)&t, sizeof(T));
}
// Use getFormId instead
void get(FormId& value) = delete;
template <typename T>
bool getExact(T& t)
{

Loading…
Cancel
Save