From 9e55425b71cfd906294cabb8223b88926875f16b Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 24 Jan 2024 20:39:04 +0400 Subject: [PATCH] Use std::move() in /apps/openmw --- apps/openmw/mwclass/ingredient.cpp | 2 +- apps/openmw/mwgui/charactercreation.cpp | 12 ++++++------ apps/openmw/mwgui/dialogue.cpp | 4 ++-- apps/openmw/mwgui/postprocessorhud.cpp | 6 +++--- apps/openmw/mwlua/cellbindings.cpp | 2 +- apps/openmw/mwlua/objectbindings.cpp | 4 ++-- apps/openmw/mwmechanics/character.cpp | 6 +++--- apps/openmw/mwrender/characterpreview.cpp | 4 ++-- apps/openmw/mwrender/creatureanimation.cpp | 2 +- apps/openmw/mwrender/globalmap.cpp | 2 +- apps/openmw/mwrender/npcanimation.cpp | 2 +- apps/openmw/mwscript/miscextensions.cpp | 2 +- apps/openmw/mwsound/soundmanagerimp.cpp | 12 ++++++------ apps/openmw/mwworld/containerstore.cpp | 2 +- apps/openmw/mwworld/store.cpp | 2 +- 15 files changed, 32 insertions(+), 32 deletions(-) diff --git a/apps/openmw/mwclass/ingredient.cpp b/apps/openmw/mwclass/ingredient.cpp index 5225170be7..6bd28103f8 100644 --- a/apps/openmw/mwclass/ingredient.cpp +++ b/apps/openmw/mwclass/ingredient.cpp @@ -143,7 +143,7 @@ namespace MWClass list.push_back(params); } - info.effects = list; + info.effects = std::move(list); info.text = std::move(text); info.isIngredient = true; diff --git a/apps/openmw/mwgui/charactercreation.cpp b/apps/openmw/mwgui/charactercreation.cpp index 4141e61e34..c5280d1615 100644 --- a/apps/openmw/mwgui/charactercreation.cpp +++ b/apps/openmw/mwgui/charactercreation.cpp @@ -63,17 +63,17 @@ namespace switch (order) { case 0: - return { question, { r0, r1, r2 }, sound }; + return { std::move(question), { std::move(r0), std::move(r1), std::move(r2) }, std::move(sound) }; case 1: - return { question, { r0, r2, r1 }, sound }; + return { std::move(question), { std::move(r0), std::move(r2), std::move(r1) }, std::move(sound) }; case 2: - return { question, { r1, r0, r2 }, sound }; + return { std::move(question), { std::move(r1), std::move(r0), std::move(r2) }, std::move(sound) }; case 3: - return { question, { r1, r2, r0 }, sound }; + return { std::move(question), { std::move(r1), std::move(r2), std::move(r0) }, std::move(sound) }; case 4: - return { question, { r2, r0, r1 }, sound }; + return { std::move(question), { std::move(r2), std::move(r0), std::move(r1) }, std::move(sound) }; default: - return { question, { r2, r1, r0 }, sound }; + return { std::move(question), { std::move(r2), std::move(r1), std::move(r0) }, std::move(sound) }; } } } diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp index ce79e2834c..56f69eb906 100644 --- a/apps/openmw/mwgui/dialogue.cpp +++ b/apps/openmw/mwgui/dialogue.cpp @@ -196,7 +196,7 @@ namespace MWGui std::string topicName = Misc::StringUtils::lowerCase(windowManager->getTranslationDataStorage().topicStandardForm(link)); - std::string displayName = link; + std::string displayName = std::move(link); while (displayName[displayName.size() - 1] == '*') displayName.erase(displayName.size() - 1, 1); @@ -248,7 +248,7 @@ namespace MWGui i = match.mEnd; } if (i != text.end()) - addTopicLink(typesetter, 0, i - text.begin(), text.size()); + addTopicLink(std::move(typesetter), 0, i - text.begin(), text.size()); } } diff --git a/apps/openmw/mwgui/postprocessorhud.cpp b/apps/openmw/mwgui/postprocessorhud.cpp index ab5bdf791d..6f73c5a9fd 100644 --- a/apps/openmw/mwgui/postprocessorhud.cpp +++ b/apps/openmw/mwgui/postprocessorhud.cpp @@ -136,9 +136,9 @@ namespace MWGui return; if (enabled) - processor->enableTechnique(technique); + processor->enableTechnique(std::move(technique)); else - processor->disableTechnique(technique); + processor->disableTechnique(std::move(technique)); processor->saveChain(); } } @@ -171,7 +171,7 @@ namespace MWGui if (technique->getDynamic()) return; - if (processor->enableTechnique(technique, index) != MWRender::PostProcessor::Status_Error) + if (processor->enableTechnique(std::move(technique), index) != MWRender::PostProcessor::Status_Error) processor->saveChain(); } } diff --git a/apps/openmw/mwlua/cellbindings.cpp b/apps/openmw/mwlua/cellbindings.cpp index 081df13a0e..39dad5a867 100644 --- a/apps/openmw/mwlua/cellbindings.cpp +++ b/apps/openmw/mwlua/cellbindings.cpp @@ -270,7 +270,7 @@ namespace MWLua if (!ok) throw std::runtime_error( std::string("Incorrect type argument in cell:getAll: " + LuaUtil::toString(*type))); - return GObjectList{ res }; + return GObjectList{ std::move(res) }; }; } } diff --git a/apps/openmw/mwlua/objectbindings.cpp b/apps/openmw/mwlua/objectbindings.cpp index 748d963bdc..47c55e86f0 100644 --- a/apps/openmw/mwlua/objectbindings.cpp +++ b/apps/openmw/mwlua/objectbindings.cpp @@ -613,7 +613,7 @@ namespace MWLua MWBase::Environment::get().getWorldModel()->registerPtr(item); list->push_back(getId(item)); } - return ObjectList{ list }; + return ObjectList{ std::move(list) }; }; inventoryT["countOf"] = [](const InventoryT& inventory, std::string_view recordId) { @@ -661,7 +661,7 @@ namespace MWLua list->push_back(getId(item)); } } - return ObjectList{ list }; + return ObjectList{ std::move(list) }; }; } diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 20c7fd0a92..f1bec8ce9d 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -684,7 +684,7 @@ namespace MWMechanics if (!mAnimation->hasAnimation(weapMovementAnimName)) weapMovementAnimName = fallbackShortWeaponGroup(movementAnimName, &movemask); - movementAnimName = weapMovementAnimName; + movementAnimName = std::move(weapMovementAnimName); } if (!mAnimation->hasAnimation(movementAnimName)) @@ -798,7 +798,7 @@ namespace MWMechanics weapIdleGroup += weapShortGroup; if (!mAnimation->hasAnimation(weapIdleGroup)) weapIdleGroup = fallbackShortWeaponGroup(idleGroup); - idleGroup = weapIdleGroup; + idleGroup = std::move(weapIdleGroup); // play until the Loop Stop key 2 to 5 times, then play until the Stop key // this replicates original engine behavior for the "Idle1h" 1st-person animation @@ -820,7 +820,7 @@ namespace MWMechanics mAnimation->getInfo(mCurrentIdle, &startPoint); clearStateAnimation(mCurrentIdle); - mCurrentIdle = idleGroup; + mCurrentIdle = std::move(idleGroup); mAnimation->play(mCurrentIdle, priority, MWRender::Animation::BlendMask_All, false, 1.0f, "start", "stop", startPoint, numLoops, true); } diff --git a/apps/openmw/mwrender/characterpreview.cpp b/apps/openmw/mwrender/characterpreview.cpp index 88ceeabd23..269f7cab75 100644 --- a/apps/openmw/mwrender/characterpreview.cpp +++ b/apps/openmw/mwrender/characterpreview.cpp @@ -436,7 +436,7 @@ namespace MWRender // We still should use one-handed animation as fallback if (mAnimation->hasAnimation(inventoryGroup)) - groupname = inventoryGroup; + groupname = std::move(inventoryGroup); else { static const std::string oneHandFallback @@ -456,7 +456,7 @@ namespace MWRender mAnimation->showCarriedLeft(showCarriedLeft); - mCurrentAnimGroup = groupname; + mCurrentAnimGroup = std::move(groupname); mAnimation->play(mCurrentAnimGroup, 1, Animation::BlendMask_All, false, 1.0f, "start", "stop", 0.0f, 0); MWWorld::ConstContainerStoreIterator torch = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft); diff --git a/apps/openmw/mwrender/creatureanimation.cpp b/apps/openmw/mwrender/creatureanimation.cpp index 040ba320a1..58e03aa0a2 100644 --- a/apps/openmw/mwrender/creatureanimation.cpp +++ b/apps/openmw/mwrender/creatureanimation.cpp @@ -170,7 +170,7 @@ namespace MWRender else source = mAnimationTimePtr[0]; - SceneUtil::AssignControllerSourcesVisitor assignVisitor(source); + SceneUtil::AssignControllerSourcesVisitor assignVisitor(std::move(source)); attached->accept(assignVisitor); } catch (std::exception& e) diff --git a/apps/openmw/mwrender/globalmap.cpp b/apps/openmw/mwrender/globalmap.cpp index e58f987a44..f9dae65c40 100644 --- a/apps/openmw/mwrender/globalmap.cpp +++ b/apps/openmw/mwrender/globalmap.cpp @@ -363,7 +363,7 @@ namespace MWRender imageDest.mImage = image; imageDest.mX = x; imageDest.mY = y; - mPendingImageDest[camera] = imageDest; + mPendingImageDest[camera] = std::move(imageDest); } // Create a quad rendering the updated texture diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 84522ee86e..b9ea257c9f 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -853,7 +853,7 @@ namespace MWRender src = mWeaponAnimationTime; else src = mAnimationTimePtr[0]; - SceneUtil::AssignControllerSourcesVisitor assignVisitor(src); + SceneUtil::AssignControllerSourcesVisitor assignVisitor(std::move(src)); node->accept(assignVisitor); } } diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index 9d75334f00..476cacafd0 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -1473,7 +1473,7 @@ namespace MWScript if (lastTextureSrc.empty() || textureSrc != lastTextureSrc) { - lastTextureSrc = textureSrc; + lastTextureSrc = std::move(textureSrc); if (lastTextureSrc.empty()) lastTextureSrc = "[No Source]"; diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index 383d316c91..0cc276807f 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -223,7 +223,7 @@ namespace MWSound params.mFlags = PlayMode::NoEnv | Type::Voice | Play_2D; return params; }()); - played = mOutput->streamSound(decoder, sound.get(), true); + played = mOutput->streamSound(std::move(decoder), sound.get(), true); } else { @@ -236,7 +236,7 @@ namespace MWSound params.mFlags = PlayMode::Normal | Type::Voice | Play_3D; return params; }()); - played = mOutput->streamSound3D(decoder, sound.get(), true); + played = mOutput->streamSound3D(std::move(decoder), sound.get(), true); } if (!played) return nullptr; @@ -282,7 +282,7 @@ namespace MWSound params.mFlags = PlayMode::NoEnvNoScaling | Type::Music | Play_2D; return params; }()); - mOutput->streamSound(decoder, mMusic.get()); + mOutput->streamSound(std::move(decoder), mMusic.get()); } void SoundManager::advanceMusic(const std::string& filename, float fadeOut) @@ -366,7 +366,7 @@ namespace MWSound for (const auto& name : mVFS->getRecursiveDirectoryIterator(playlistPath)) filelist.push_back(name); - mMusicFiles[playlist] = filelist; + mMusicFiles[playlist] = std::move(filelist); } // No Battle music? Use Explore playlist @@ -393,7 +393,7 @@ namespace MWSound const osg::Vec3f pos = world->getActorHeadTransform(ptr).getTrans(); stopSay(ptr); - StreamPtr sound = playVoice(decoder, pos, (ptr == MWMechanics::getPlayer())); + StreamPtr sound = playVoice(std::move(decoder), pos, (ptr == MWMechanics::getPlayer())); if (!sound) return; @@ -422,7 +422,7 @@ namespace MWSound return; stopSay(MWWorld::ConstPtr()); - StreamPtr sound = playVoice(decoder, osg::Vec3f(), true); + StreamPtr sound = playVoice(std::move(decoder), osg::Vec3f(), true); if (!sound) return; diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index d30ea21494..f48f73f48a 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -719,7 +719,7 @@ MWWorld::ResolutionHandle MWWorld::ContainerStore::resolveTemporarily() fill(container.get()->mBase->mInventory, ESM::RefId(), prng); addScripts(*this, container.mCell); } - return { listener }; + return { std::move(listener) }; } void MWWorld::ContainerStore::unresolve() diff --git a/apps/openmw/mwworld/store.cpp b/apps/openmw/mwworld/store.cpp index ac3ee72a94..10d9fb3f3b 100644 --- a/apps/openmw/mwworld/store.cpp +++ b/apps/openmw/mwworld/store.cpp @@ -893,7 +893,7 @@ namespace MWWorld // Try to overwrite existing record auto ret = mStatic.emplace(cell, pathgrid); if (!ret.second) - ret.first->second = pathgrid; + ret.first->second = std::move(pathgrid); return RecordId(ESM::RefId(), isDeleted); }