From 218f916d6da5c63203fa7001cfbac3cc37d34b2a Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 19 Jun 2014 17:17:26 +0200 Subject: [PATCH] Savegame: Don't write stat modifiers that are zero --- components/esm/statstate.hpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/components/esm/statstate.hpp b/components/esm/statstate.hpp index 4b4023bc22..f1a3b4d794 100644 --- a/components/esm/statstate.hpp +++ b/components/esm/statstate.hpp @@ -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::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::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 \ No newline at end of file +#endif