From ca8869042bd307632803381f687223e34bce55c1 Mon Sep 17 00:00:00 2001 From: elsid Date: Sat, 15 Jun 2024 00:27:25 +0200 Subject: [PATCH] Move LiveCellRef where possible --- apps/openmw/mwworld/cellstore.cpp | 8 ++++---- apps/openmw/mwworld/containerstore.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index 6f3d23593b..c22f873fe9 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -319,7 +319,7 @@ namespace // new reference MWWorld::LiveCellRef 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 liveCellRef(ref, ptr); if (!isEnabled(ref, esmStore)) liveCellRef.mData.disable(); - list.push_back(liveCellRef); + list.push_back(std::move(liveCellRef)); } template diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index f48f73f48a..5e020ac886 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -103,7 +103,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::getState( LiveCellRef 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);