diff options
author | Alexei Kotov <alexdobrohotov@yandex.ru> | 2024-02-25 10:07:52 +0000 |
---|---|---|
committer | Alexei Kotov <alexdobrohotov@yandex.ru> | 2024-02-25 10:07:52 +0000 |
commit | 357b1905714f71a0ed23f18fb3008f9f1fd0e9ad (patch) | |
tree | bd3ba3d44d7e592a0dccd0f07523bb39844e550c | |
parent | 01e0b25fd3933fbfd10d07c1602658a9db9bdab0 (diff) | |
parent | 0bab37327c0055120687d9db64ac04de99fd3249 (diff) |
Merge branch 'oldsavessuck' into 'master'
Account for pre-0.46 saves storing a gold value of 0 for everything
See merge request OpenMW/openmw!3902
-rw-r--r-- | components/esm3/formatversion.hpp | 1 | ||||
-rw-r--r-- | components/esm3/objectstate.cpp | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/components/esm3/formatversion.hpp b/components/esm3/formatversion.hpp index 9f499a7231..d90742a512 100644 --- a/components/esm3/formatversion.hpp +++ b/components/esm3/formatversion.hpp @@ -9,6 +9,7 @@ namespace ESM inline constexpr FormatVersion DefaultFormatVersion = 0; inline constexpr FormatVersion CurrentContentFormatVersion = 1; + inline constexpr FormatVersion MaxOldGoldValueFormatVersion = 5; inline constexpr FormatVersion MaxOldFogOfWarFormatVersion = 6; inline constexpr FormatVersion MaxUnoptimizedCharacterDataFormatVersion = 7; inline constexpr FormatVersion MaxOldTimeLeftFormatVersion = 8; diff --git a/components/esm3/objectstate.cpp b/components/esm3/objectstate.cpp index 25cbdc9a98..f8905cfaea 100644 --- a/components/esm3/objectstate.cpp +++ b/components/esm3/objectstate.cpp @@ -30,7 +30,11 @@ namespace ESM esm.getHNOT(mEnabled, "ENAB"); if (mVersion <= MaxOldCountFormatVersion) - esm.getHNOT(mRef.mCount, "COUN"); + { + if (mVersion <= MaxOldGoldValueFormatVersion) + mRef.mCount = std::max(1, mRef.mCount); + esm.getHNOT("COUN", mRef.mCount); + } mPosition = mRef.mPos; esm.getHNOT("POS_", mPosition.pos, mPosition.rot); |