diff --git a/apps/openmw/mwworld/storedevel/store.hpp b/apps/openmw/mwworld/storedevel/store.hpp index 9d94e677e..c41fbc64c 100644 --- a/apps/openmw/mwworld/storedevel/store.hpp +++ b/apps/openmw/mwworld/storedevel/store.hpp @@ -184,7 +184,9 @@ namespace MWWorld std::vector mShared; public: - Store() {} + Store() + : mComp(false) + {} Store(bool ci) : mComp(ci) @@ -217,6 +219,31 @@ namespace MWWorld return ptr; } + void load(ESM::ESMReader &esm, const std::string &id) { + // reduce size of allocated memory to copy + mData.push_back(T()); + + // some records requires id before loading + // make sure that string case is the same across container + if (mComp.isCaseInsensitive()) { + mData.back().mId = id; + } else { + mData.back().mId = lowerCase(id); + } + mData.back().load(esm); + + // allow records to overwrite id on loading + if (!mComp.isCaseInsensitive()) { + std::string &s = mData.back().mId; + std::transform( + s.begin(), + s.end(), + s.begin(), + (int (*)(int)) std::tolower + ); + } + } + void setUp() { std::sort(mData.begin(), mData.end(), mComp);