mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-01 03:21:41 +00:00
Savegame: Don't write stat modifiers that are zero
This commit is contained in:
parent
11b05c352f
commit
218f916d6d
@ -12,7 +12,8 @@ namespace ESM
|
||||
struct StatState
|
||||
{
|
||||
T mBase;
|
||||
T mMod;
|
||||
T mMod; // Note: can either be the modifier, or the modified value.
|
||||
// A bit inconsistent, but we can't fix this without breaking compatibility.
|
||||
T mCurrent;
|
||||
T mDamage;
|
||||
float mProgress;
|
||||
@ -30,7 +31,9 @@ namespace ESM
|
||||
void StatState<T>::load (ESMReader &esm)
|
||||
{
|
||||
esm.getHNT (mBase, "STBA");
|
||||
esm.getHNT (mMod, "STMO");
|
||||
|
||||
mMod = 0;
|
||||
esm.getHNOT (mMod, "STMO");
|
||||
mCurrent = 0;
|
||||
esm.getHNOT (mCurrent, "STCU");
|
||||
mDamage = 0;
|
||||
@ -43,7 +46,9 @@ namespace ESM
|
||||
void StatState<T>::save (ESMWriter &esm) const
|
||||
{
|
||||
esm.writeHNT ("STBA", mBase);
|
||||
esm.writeHNT ("STMO", mMod);
|
||||
|
||||
if (mMod != 0)
|
||||
esm.writeHNT ("STMO", mMod);
|
||||
|
||||
if (mCurrent)
|
||||
esm.writeHNT ("STCU", mCurrent);
|
||||
@ -56,4 +61,4 @@ namespace ESM
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user