1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-24 12:11:34 +00:00

Merge branch 'esm_store_find_static' into 'master'

Store static id key in lower case

See merge request OpenMW/openmw!1750
This commit is contained in:
psi29a 2022-04-08 07:58:10 +00:00
commit 8f04be8e20
3 changed files with 13 additions and 4 deletions

View file

@ -440,7 +440,10 @@ namespace MWRender
if (moved)
continue;
if (std::find(cell->mMovedRefs.begin(), cell->mMovedRefs.end(), ref.mRefNum) != cell->mMovedRefs.end()) continue;
if (std::find(cell->mMovedRefs.begin(), cell->mMovedRefs.end(), ref.mRefNum) != cell->mMovedRefs.end())
continue;
Misc::StringUtils::lowerCaseInPlace(ref.mRefID);
int type = store.findStatic(ref.mRefID);
if (!typeFilter(type,size>=2)) continue;
if (deleted) { refs.erase(ref.mRefNum); continue; }
@ -454,7 +457,12 @@ namespace MWRender
}
for (auto [ref, deleted] : cell->mLeasedRefs)
{
if (deleted) { refs.erase(ref.mRefNum); continue; }
if (deleted)
{
refs.erase(ref.mRefNum);
continue;
}
Misc::StringUtils::lowerCaseInPlace(ref.mRefID);
int type = store.findStatic(ref.mRefID);
if (!typeFilter(type,size>=2)) continue;
refs[ref.mRefNum] = std::move(ref);

View file

@ -257,7 +257,8 @@ void ESMStore::setUp(bool validateRecords)
}
if (mStaticIds.empty())
mStaticIds = mIds;
for (const auto& [k, v] : mIds)
mStaticIds.emplace(Misc::StringUtils::lowerCase(k), v);
mSkills.setUp();
mMagicEffects.setUp();

View file

@ -77,7 +77,7 @@ namespace MWWorld
// maps the id name to the record type.
using IDMap = std::unordered_map<std::string, int, Misc::StringUtils::CiHash, Misc::StringUtils::CiEqual>;
IDMap mIds;
IDMap mStaticIds;
std::unordered_map<std::string, int> mStaticIds;
std::unordered_map<std::string, int> mRefCount;