Fix misaligned address

macos_ci_fix
Evil Eye 1 year ago
parent 88731f864e
commit 9f38ee82f4

@ -154,20 +154,32 @@ namespace ESM
if (mNpdtType == NPC_DEFAULT)
{
esm.writeHNT("NPDT", mNpdt, 52);
esm.startSubRecord("NPDT");
esm.writeT(mNpdt.mLevel);
esm.writeT(mNpdt.mAttributes);
esm.writeT(mNpdt.mSkills);
esm.writeT(mNpdt.mUnknown1);
esm.writeT(mNpdt.mHealth);
esm.writeT(mNpdt.mMana);
esm.writeT(mNpdt.mFatigue);
esm.writeT(mNpdt.mDisposition);
esm.writeT(mNpdt.mReputation);
esm.writeT(mNpdt.mRank);
esm.writeT(mNpdt.mUnknown2);
esm.writeT(mNpdt.mGold);
esm.endRecord("NPDT");
}
else if (mNpdtType == NPC_WITH_AUTOCALCULATED_STATS)
{
NPDTstruct12 npdt12;
npdt12.mLevel = mNpdt.mLevel;
npdt12.mDisposition = mNpdt.mDisposition;
npdt12.mReputation = mNpdt.mReputation;
npdt12.mRank = mNpdt.mRank;
npdt12.mUnknown1 = 0;
npdt12.mUnknown2 = 0;
npdt12.mUnknown3 = 0;
npdt12.mGold = mNpdt.mGold;
esm.writeHNT("NPDT", npdt12, 12);
esm.startSubRecord("NPDT");
esm.writeT(mNpdt.mLevel);
esm.writeT(mNpdt.mDisposition);
esm.writeT(mNpdt.mReputation);
esm.writeT(mNpdt.mRank);
constexpr char padding[] = { 0, 0, 0 };
esm.writeT(padding);
esm.writeT(mNpdt.mGold);
esm.endRecord("NPDT");
}
esm.writeHNT("FLAG", ((mBloodType << 10) + mFlags));

@ -75,9 +75,6 @@ namespace ESM
NPC_DEFAULT = 52
};
#pragma pack(push)
#pragma pack(1)
struct NPDTstruct52
{
int16_t mLevel;
@ -93,18 +90,6 @@ namespace ESM
int32_t mGold;
}; // 52 bytes
// Structure for autocalculated characters.
// This is only used for load and save operations.
struct NPDTstruct12
{
int16_t mLevel;
// see above
unsigned char mDisposition, mReputation, mRank;
char mUnknown1, mUnknown2, mUnknown3;
int32_t mGold;
}; // 12 bytes
#pragma pack(pop)
unsigned char mNpdtType;
// Worth noting when saving the struct:
// Although we might read a NPDTstruct12 in, we use NPDTstruct52 internally

Loading…
Cancel
Save