Merge branch 'movable_objects' into 'master'

Move objects instead of copying where possible

See merge request OpenMW/openmw!3289
This commit is contained in:
psi29a 2023-08-01 10:43:44 +00:00
commit c86eecb2ea
66 changed files with 110 additions and 110 deletions

View file

@ -10,7 +10,7 @@
#include <components/esm3/esmreader.hpp>
#include <components/files/qtconversion.hpp>
ContentSelectorModel::ContentModel::ContentModel(QObject* parent, QIcon warningIcon, bool showOMWScripts)
ContentSelectorModel::ContentModel::ContentModel(QObject* parent, QIcon& warningIcon, bool showOMWScripts)
: QAbstractTableModel(parent)
, mWarningIcon(warningIcon)
, mShowOMWScripts(showOMWScripts)

View file

@ -23,7 +23,7 @@ namespace ContentSelectorModel
{
Q_OBJECT
public:
explicit ContentModel(QObject* parent, QIcon warningIcon, bool showOMWScripts);
explicit ContentModel(QObject* parent, QIcon& warningIcon, bool showOMWScripts);
~ContentModel();
void setEncoding(const QString& encoding);

View file

@ -12,7 +12,7 @@ QString ContentSelectorModel::EsmFile::sToolTip = QString(
<br/><b>Description:</b><br/>%5<br/> \
<br/><b>Dependencies: </b>%6<br/>");
ContentSelectorModel::EsmFile::EsmFile(QString fileName, ModelItem* parent)
ContentSelectorModel::EsmFile::EsmFile(const QString& fileName, ModelItem* parent)
: ModelItem(parent)
, mFileName(fileName)
{

View file

@ -29,7 +29,7 @@ namespace ContentSelectorModel
FileProperty_GameFile = 6
};
EsmFile(QString fileName = QString(), ModelItem* parent = nullptr);
EsmFile(const QString& fileName = QString(), ModelItem* parent = nullptr);
// EsmFile(const EsmFile &);
~EsmFile() {}

View file

@ -21,7 +21,7 @@ namespace ContentSelectorModel
: mErrorCode(ErrorCode_None)
{
}
inline LoadOrderError(ErrorCode errorCode, QString fileName)
inline LoadOrderError(ErrorCode errorCode, const QString& fileName)
: mErrorCode(errorCode)
, mFileName(fileName)
{

View file

@ -336,7 +336,7 @@ namespace Debug
}
Debug::DebugDrawer::DebugDrawer(Shader::ShaderManager& shaderManager, osg::ref_ptr<osg::Group> parentNode)
: mParentNode(parentNode)
: mParentNode(std::move(parentNode))
{
mCurrentFrame = 0;

View file

@ -22,7 +22,7 @@ namespace ESM
if (mList.empty())
Log(Debug::Warning) << "Encountered DNAM record without DODT record, skipped.";
else
mList.back().mCellName = name;
mList.back().mCellName = std::move(name);
}
}

View file

@ -264,6 +264,6 @@ void Fallback::validate(boost::any& v, std::vector<std::string> const& tokens, F
std::string key(token.substr(0, sep));
std::string value(token.substr(sep + 1));
map->mMap[key] = value;
map->mMap[key] = std::move(value);
}
}

View file

@ -408,7 +408,7 @@ namespace Gui
file.reset();
// Create the font texture
std::string bitmapFilename = "fonts/" + std::string(name) + ".tex";
std::string bitmapFilename = "fonts/" + std::move(name) + ".tex";
Files::IStreamPtr bitmapFile = mVFS->get(bitmapFilename);

View file

@ -95,7 +95,10 @@ namespace fx
mData.get<WeatherTransition>() = transition > 0 ? 1 - transition : 0;
}
void bindPointLights(std::shared_ptr<SceneUtil::PPLightBuffer> buffer) { mPointLightBuffer = buffer; }
void bindPointLights(std::shared_ptr<SceneUtil::PPLightBuffer> buffer)
{
mPointLightBuffer = std::move(buffer);
}
static std::string getStructDefinition()
{

View file

@ -30,7 +30,7 @@ namespace Resource
const VFS::Manager* vfs)
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
, mTarget(target)
, mAnimationManager(animationManager)
, mAnimationManager(std::move(animationManager))
, mNormalized(normalized)
, mVFS(vfs)
{

View file

@ -22,7 +22,7 @@ namespace SceneUtil
public:
CopyRigVisitor(osg::ref_ptr<osg::Group> parent, std::string_view filter)
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
, mParent(parent)
, mParent(std::move(parent))
, mFilter(filter)
{
}

View file

@ -29,12 +29,12 @@ namespace SceneUtil
void Controller::setSource(std::shared_ptr<ControllerSource> source)
{
mSource = source;
mSource = std::move(source);
}
void Controller::setFunction(std::shared_ptr<ControllerFunction> function)
{
mFunction = function;
mFunction = std::move(function);
}
std::shared_ptr<ControllerSource> Controller::getSource() const
@ -105,7 +105,7 @@ namespace SceneUtil
AssignControllerSourcesVisitor::AssignControllerSourcesVisitor(std::shared_ptr<ControllerSource> toAssign)
: ControllerVisitor()
, mToAssign(toAssign)
, mToAssign(std::move(toAssign))
{
}
@ -121,7 +121,7 @@ namespace SceneUtil
}
ForceControllerSourcesVisitor::ForceControllerSourcesVisitor(std::shared_ptr<ControllerSource> toAssign)
: AssignControllerSourcesVisitor(toAssign)
: AssignControllerSourcesVisitor(std::move(toAssign))
{
}

View file

@ -69,7 +69,7 @@ namespace SceneUtil
}
osg::ref_ptr<OsgaRigGeometry> rigGeometry = new OsgaRigGeometry(*copy.getSourceRigGeometry(), copyop);
setSourceRigGeometry(rigGeometry);
setSourceRigGeometry(std::move(rigGeometry));
}
RigGeometryHolder::RigGeometryHolder(const osgAnimation::RigGeometry& copy, const osg::CopyOp& copyop)
@ -80,7 +80,7 @@ namespace SceneUtil
setUseVertexBufferObjects(true);
osg::ref_ptr<OsgaRigGeometry> rigGeometry = new OsgaRigGeometry(copy, copyop);
setSourceRigGeometry(rigGeometry);
setSourceRigGeometry(std::move(rigGeometry));
}
void RigGeometryHolder::setSourceRigGeometry(osg::ref_ptr<OsgaRigGeometry> sourceRigGeometry)
@ -192,7 +192,7 @@ namespace SceneUtil
}
osg::MatrixList mtxList
= root->getWorldMatrices(root); // We always assume that RigGeometries have origin at their root
geom->computeMatrixFromRootSkeleton(mtxList);
geom->computeMatrixFromRootSkeleton(std::move(mtxList));
if (mIsBodyPart && mBackToOrigin)
updateBackToOriginTransform(geom);

View file

@ -105,7 +105,7 @@ namespace SceneUtil
const std::string& screenshotFormat, std::function<void(std::string)> callback)
: mScreenshotPath(screenshotPath)
, mScreenshotFormat(screenshotFormat)
, mCallback(callback)
, mCallback(std::move(callback))
{
}

View file

@ -10,7 +10,7 @@ namespace SDLUtil
InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr<osgViewer::Viewer> viewer, bool grab)
: mSDLWindow(window)
, mViewer(viewer)
, mViewer(std::move(viewer))
, mMouseListener(nullptr)
, mSensorListener(nullptr)
, mKeyboardListener(nullptr)

View file

@ -13,7 +13,7 @@ namespace SDLUtil
VideoWrapper::VideoWrapper(SDL_Window* window, osg::ref_ptr<osgViewer::Viewer> viewer)
: mWindow(window)
, mViewer(viewer)
, mViewer(std::move(viewer))
, mGamma(1.f)
, mContrast(1.f)
, mHasSetGammaContrast(false)

View file

@ -348,7 +348,7 @@ namespace Stereo
void Manager::setUpdateViewCallback(std::shared_ptr<UpdateViewCallback> cb)
{
mUpdateViewCallback = cb;
mUpdateViewCallback = std::move(cb);
}
void Manager::setCullCallback(osg::ref_ptr<osg::NodeCallback> cb)
@ -382,7 +382,7 @@ namespace Stereo
return sStereoEnabled;
}
Manager::CustomViewCallback::CustomViewCallback(View left, View right)
Manager::CustomViewCallback::CustomViewCallback(View& left, View& right)
: mLeft(left)
, mRight(right)
{

View file

@ -59,7 +59,7 @@ namespace Stereo
struct CustomViewCallback : public UpdateViewCallback
{
public:
CustomViewCallback(View left, View right);
CustomViewCallback(View& left, View& right);
void updateView(View& left, View& right) override;