Do not copy cell store to count refs

This commit is contained in:
elsid 2025-07-27 18:40:39 +02:00
parent 8deb050ea2
commit e77ee5c20f
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

View File

@ -566,10 +566,10 @@ namespace MWWorld
std::vector<Ref> refs;
std::set<ESM::RefId> keyIDs;
std::vector<ESM::RefId> refIDs;
Store<ESM::Cell> Cells = get<ESM::Cell>();
for (auto it = Cells.intBegin(); it != Cells.intEnd(); ++it)
const Store<ESM::Cell>& cells = get<ESM::Cell>();
for (auto it = cells.intBegin(); it != cells.intEnd(); ++it)
readRefs(*it, refs, refIDs, keyIDs, readers);
for (auto it = Cells.extBegin(); it != Cells.extEnd(); ++it)
for (auto it = cells.extBegin(); it != cells.extEnd(); ++it)
readRefs(*it, refs, refIDs, keyIDs, readers);
const auto lessByRefNum = [](const Ref& l, const Ref& r) { return l.mRefNum < r.mRefNum; };
std::stable_sort(refs.begin(), refs.end(), lessByRefNum);