1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-27 03:35:27 +00:00

Move LiveCellRef where possible

This commit is contained in:
elsid 2024-06-15 00:27:25 +02:00
parent f456978cc3
commit ca8869042b
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625
2 changed files with 5 additions and 5 deletions

View File

@ -319,7 +319,7 @@ namespace
// new reference
MWWorld::LiveCellRef<T> ref(record);
ref.load(state);
collection.mList.push_back(ref);
collection.mList.push_back(std::move(ref));
MWWorld::LiveCellRefBase* base = &collection.mList.back();
MWBase::Environment::get().getWorldModel()->registerPtr(MWWorld::Ptr(base, cellstore));
@ -426,9 +426,9 @@ namespace MWWorld
liveCellRef.mData.setDeletedByContentFile(true);
if (iter != mList.end())
*iter = liveCellRef;
*iter = std::move(liveCellRef);
else
mList.push_back(liveCellRef);
mList.push_back(std::move(liveCellRef));
}
else
{
@ -455,7 +455,7 @@ namespace MWWorld
LiveCellRef<X> liveCellRef(ref, ptr);
if (!isEnabled(ref, esmStore))
liveCellRef.mData.disable();
list.push_back(liveCellRef);
list.push_back(std::move(liveCellRef));
}
template <typename X>

View File

@ -103,7 +103,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::getState(
LiveCellRef<T> ref(record);
ref.load(state);
collection.mList.push_back(ref);
collection.mList.push_back(std::move(ref));
auto it = ContainerStoreIterator(this, --collection.mList.end());
MWBase::Environment::get().getWorldModel()->registerPtr(*it);