mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-25 16:43:33 +00:00
Fix misaligned address
This commit is contained in:
parent
88731f864e
commit
9f38ee82f4
@ -154,20 +154,32 @@ namespace ESM
|
|||||||
|
|
||||||
if (mNpdtType == NPC_DEFAULT)
|
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)
|
else if (mNpdtType == NPC_WITH_AUTOCALCULATED_STATS)
|
||||||
{
|
{
|
||||||
NPDTstruct12 npdt12;
|
esm.startSubRecord("NPDT");
|
||||||
npdt12.mLevel = mNpdt.mLevel;
|
esm.writeT(mNpdt.mLevel);
|
||||||
npdt12.mDisposition = mNpdt.mDisposition;
|
esm.writeT(mNpdt.mDisposition);
|
||||||
npdt12.mReputation = mNpdt.mReputation;
|
esm.writeT(mNpdt.mReputation);
|
||||||
npdt12.mRank = mNpdt.mRank;
|
esm.writeT(mNpdt.mRank);
|
||||||
npdt12.mUnknown1 = 0;
|
constexpr char padding[] = { 0, 0, 0 };
|
||||||
npdt12.mUnknown2 = 0;
|
esm.writeT(padding);
|
||||||
npdt12.mUnknown3 = 0;
|
esm.writeT(mNpdt.mGold);
|
||||||
npdt12.mGold = mNpdt.mGold;
|
esm.endRecord("NPDT");
|
||||||
esm.writeHNT("NPDT", npdt12, 12);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
esm.writeHNT("FLAG", ((mBloodType << 10) + mFlags));
|
esm.writeHNT("FLAG", ((mBloodType << 10) + mFlags));
|
||||||
|
@ -75,9 +75,6 @@ namespace ESM
|
|||||||
NPC_DEFAULT = 52
|
NPC_DEFAULT = 52
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(push)
|
|
||||||
#pragma pack(1)
|
|
||||||
|
|
||||||
struct NPDTstruct52
|
struct NPDTstruct52
|
||||||
{
|
{
|
||||||
int16_t mLevel;
|
int16_t mLevel;
|
||||||
@ -93,18 +90,6 @@ namespace ESM
|
|||||||
int32_t mGold;
|
int32_t mGold;
|
||||||
}; // 52 bytes
|
}; // 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;
|
unsigned char mNpdtType;
|
||||||
// Worth noting when saving the struct:
|
// Worth noting when saving the struct:
|
||||||
// Although we might read a NPDTstruct12 in, we use NPDTstruct52 internally
|
// Although we might read a NPDTstruct12 in, we use NPDTstruct52 internally
|
||||||
|
Loading…
x
Reference in New Issue
Block a user