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

Use std::move() in /apps/openmw

This commit is contained in:
Andrei Kortunov 2024-01-24 20:39:04 +04:00
parent c77da18865
commit 9e55425b71
15 changed files with 32 additions and 32 deletions

View File

@ -143,7 +143,7 @@ namespace MWClass
list.push_back(params); list.push_back(params);
} }
info.effects = list; info.effects = std::move(list);
info.text = std::move(text); info.text = std::move(text);
info.isIngredient = true; info.isIngredient = true;

View File

@ -63,17 +63,17 @@ namespace
switch (order) switch (order)
{ {
case 0: 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: 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: 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: 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: 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: default:
return { question, { r2, r1, r0 }, sound }; return { std::move(question), { std::move(r2), std::move(r1), std::move(r0) }, std::move(sound) };
} }
} }
} }

View File

@ -196,7 +196,7 @@ namespace MWGui
std::string topicName std::string topicName
= Misc::StringUtils::lowerCase(windowManager->getTranslationDataStorage().topicStandardForm(link)); = Misc::StringUtils::lowerCase(windowManager->getTranslationDataStorage().topicStandardForm(link));
std::string displayName = link; std::string displayName = std::move(link);
while (displayName[displayName.size() - 1] == '*') while (displayName[displayName.size() - 1] == '*')
displayName.erase(displayName.size() - 1, 1); displayName.erase(displayName.size() - 1, 1);
@ -248,7 +248,7 @@ namespace MWGui
i = match.mEnd; i = match.mEnd;
} }
if (i != text.end()) if (i != text.end())
addTopicLink(typesetter, 0, i - text.begin(), text.size()); addTopicLink(std::move(typesetter), 0, i - text.begin(), text.size());
} }
} }

View File

@ -136,9 +136,9 @@ namespace MWGui
return; return;
if (enabled) if (enabled)
processor->enableTechnique(technique); processor->enableTechnique(std::move(technique));
else else
processor->disableTechnique(technique); processor->disableTechnique(std::move(technique));
processor->saveChain(); processor->saveChain();
} }
} }
@ -171,7 +171,7 @@ namespace MWGui
if (technique->getDynamic()) if (technique->getDynamic())
return; return;
if (processor->enableTechnique(technique, index) != MWRender::PostProcessor::Status_Error) if (processor->enableTechnique(std::move(technique), index) != MWRender::PostProcessor::Status_Error)
processor->saveChain(); processor->saveChain();
} }
} }

View File

@ -270,7 +270,7 @@ namespace MWLua
if (!ok) if (!ok)
throw std::runtime_error( throw std::runtime_error(
std::string("Incorrect type argument in cell:getAll: " + LuaUtil::toString(*type))); std::string("Incorrect type argument in cell:getAll: " + LuaUtil::toString(*type)));
return GObjectList{ res }; return GObjectList{ std::move(res) };
}; };
} }
} }

View File

@ -613,7 +613,7 @@ namespace MWLua
MWBase::Environment::get().getWorldModel()->registerPtr(item); MWBase::Environment::get().getWorldModel()->registerPtr(item);
list->push_back(getId(item)); list->push_back(getId(item));
} }
return ObjectList<ObjectT>{ list }; return ObjectList<ObjectT>{ std::move(list) };
}; };
inventoryT["countOf"] = [](const InventoryT& inventory, std::string_view recordId) { inventoryT["countOf"] = [](const InventoryT& inventory, std::string_view recordId) {
@ -661,7 +661,7 @@ namespace MWLua
list->push_back(getId(item)); list->push_back(getId(item));
} }
} }
return ObjectList<ObjectT>{ list }; return ObjectList<ObjectT>{ std::move(list) };
}; };
} }

View File

@ -684,7 +684,7 @@ namespace MWMechanics
if (!mAnimation->hasAnimation(weapMovementAnimName)) if (!mAnimation->hasAnimation(weapMovementAnimName))
weapMovementAnimName = fallbackShortWeaponGroup(movementAnimName, &movemask); weapMovementAnimName = fallbackShortWeaponGroup(movementAnimName, &movemask);
movementAnimName = weapMovementAnimName; movementAnimName = std::move(weapMovementAnimName);
} }
if (!mAnimation->hasAnimation(movementAnimName)) if (!mAnimation->hasAnimation(movementAnimName))
@ -798,7 +798,7 @@ namespace MWMechanics
weapIdleGroup += weapShortGroup; weapIdleGroup += weapShortGroup;
if (!mAnimation->hasAnimation(weapIdleGroup)) if (!mAnimation->hasAnimation(weapIdleGroup))
weapIdleGroup = fallbackShortWeaponGroup(idleGroup); 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 // 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 // this replicates original engine behavior for the "Idle1h" 1st-person animation
@ -820,7 +820,7 @@ namespace MWMechanics
mAnimation->getInfo(mCurrentIdle, &startPoint); mAnimation->getInfo(mCurrentIdle, &startPoint);
clearStateAnimation(mCurrentIdle); clearStateAnimation(mCurrentIdle);
mCurrentIdle = idleGroup; mCurrentIdle = std::move(idleGroup);
mAnimation->play(mCurrentIdle, priority, MWRender::Animation::BlendMask_All, false, 1.0f, "start", "stop", mAnimation->play(mCurrentIdle, priority, MWRender::Animation::BlendMask_All, false, 1.0f, "start", "stop",
startPoint, numLoops, true); startPoint, numLoops, true);
} }

View File

@ -436,7 +436,7 @@ namespace MWRender
// We still should use one-handed animation as fallback // We still should use one-handed animation as fallback
if (mAnimation->hasAnimation(inventoryGroup)) if (mAnimation->hasAnimation(inventoryGroup))
groupname = inventoryGroup; groupname = std::move(inventoryGroup);
else else
{ {
static const std::string oneHandFallback static const std::string oneHandFallback
@ -456,7 +456,7 @@ namespace MWRender
mAnimation->showCarriedLeft(showCarriedLeft); mAnimation->showCarriedLeft(showCarriedLeft);
mCurrentAnimGroup = groupname; mCurrentAnimGroup = std::move(groupname);
mAnimation->play(mCurrentAnimGroup, 1, Animation::BlendMask_All, false, 1.0f, "start", "stop", 0.0f, 0); mAnimation->play(mCurrentAnimGroup, 1, Animation::BlendMask_All, false, 1.0f, "start", "stop", 0.0f, 0);
MWWorld::ConstContainerStoreIterator torch = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft); MWWorld::ConstContainerStoreIterator torch = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);

View File

@ -170,7 +170,7 @@ namespace MWRender
else else
source = mAnimationTimePtr[0]; source = mAnimationTimePtr[0];
SceneUtil::AssignControllerSourcesVisitor assignVisitor(source); SceneUtil::AssignControllerSourcesVisitor assignVisitor(std::move(source));
attached->accept(assignVisitor); attached->accept(assignVisitor);
} }
catch (std::exception& e) catch (std::exception& e)

View File

@ -363,7 +363,7 @@ namespace MWRender
imageDest.mImage = image; imageDest.mImage = image;
imageDest.mX = x; imageDest.mX = x;
imageDest.mY = y; imageDest.mY = y;
mPendingImageDest[camera] = imageDest; mPendingImageDest[camera] = std::move(imageDest);
} }
// Create a quad rendering the updated texture // Create a quad rendering the updated texture

View File

@ -853,7 +853,7 @@ namespace MWRender
src = mWeaponAnimationTime; src = mWeaponAnimationTime;
else else
src = mAnimationTimePtr[0]; src = mAnimationTimePtr[0];
SceneUtil::AssignControllerSourcesVisitor assignVisitor(src); SceneUtil::AssignControllerSourcesVisitor assignVisitor(std::move(src));
node->accept(assignVisitor); node->accept(assignVisitor);
} }
} }

View File

@ -1473,7 +1473,7 @@ namespace MWScript
if (lastTextureSrc.empty() || textureSrc != lastTextureSrc) if (lastTextureSrc.empty() || textureSrc != lastTextureSrc)
{ {
lastTextureSrc = textureSrc; lastTextureSrc = std::move(textureSrc);
if (lastTextureSrc.empty()) if (lastTextureSrc.empty())
lastTextureSrc = "[No Source]"; lastTextureSrc = "[No Source]";

View File

@ -223,7 +223,7 @@ namespace MWSound
params.mFlags = PlayMode::NoEnv | Type::Voice | Play_2D; params.mFlags = PlayMode::NoEnv | Type::Voice | Play_2D;
return params; return params;
}()); }());
played = mOutput->streamSound(decoder, sound.get(), true); played = mOutput->streamSound(std::move(decoder), sound.get(), true);
} }
else else
{ {
@ -236,7 +236,7 @@ namespace MWSound
params.mFlags = PlayMode::Normal | Type::Voice | Play_3D; params.mFlags = PlayMode::Normal | Type::Voice | Play_3D;
return params; return params;
}()); }());
played = mOutput->streamSound3D(decoder, sound.get(), true); played = mOutput->streamSound3D(std::move(decoder), sound.get(), true);
} }
if (!played) if (!played)
return nullptr; return nullptr;
@ -282,7 +282,7 @@ namespace MWSound
params.mFlags = PlayMode::NoEnvNoScaling | Type::Music | Play_2D; params.mFlags = PlayMode::NoEnvNoScaling | Type::Music | Play_2D;
return params; return params;
}()); }());
mOutput->streamSound(decoder, mMusic.get()); mOutput->streamSound(std::move(decoder), mMusic.get());
} }
void SoundManager::advanceMusic(const std::string& filename, float fadeOut) void SoundManager::advanceMusic(const std::string& filename, float fadeOut)
@ -366,7 +366,7 @@ namespace MWSound
for (const auto& name : mVFS->getRecursiveDirectoryIterator(playlistPath)) for (const auto& name : mVFS->getRecursiveDirectoryIterator(playlistPath))
filelist.push_back(name); filelist.push_back(name);
mMusicFiles[playlist] = filelist; mMusicFiles[playlist] = std::move(filelist);
} }
// No Battle music? Use Explore playlist // No Battle music? Use Explore playlist
@ -393,7 +393,7 @@ namespace MWSound
const osg::Vec3f pos = world->getActorHeadTransform(ptr).getTrans(); const osg::Vec3f pos = world->getActorHeadTransform(ptr).getTrans();
stopSay(ptr); stopSay(ptr);
StreamPtr sound = playVoice(decoder, pos, (ptr == MWMechanics::getPlayer())); StreamPtr sound = playVoice(std::move(decoder), pos, (ptr == MWMechanics::getPlayer()));
if (!sound) if (!sound)
return; return;
@ -422,7 +422,7 @@ namespace MWSound
return; return;
stopSay(MWWorld::ConstPtr()); stopSay(MWWorld::ConstPtr());
StreamPtr sound = playVoice(decoder, osg::Vec3f(), true); StreamPtr sound = playVoice(std::move(decoder), osg::Vec3f(), true);
if (!sound) if (!sound)
return; return;

View File

@ -719,7 +719,7 @@ MWWorld::ResolutionHandle MWWorld::ContainerStore::resolveTemporarily()
fill(container.get<ESM::Container>()->mBase->mInventory, ESM::RefId(), prng); fill(container.get<ESM::Container>()->mBase->mInventory, ESM::RefId(), prng);
addScripts(*this, container.mCell); addScripts(*this, container.mCell);
} }
return { listener }; return { std::move(listener) };
} }
void MWWorld::ContainerStore::unresolve() void MWWorld::ContainerStore::unresolve()

View File

@ -893,7 +893,7 @@ namespace MWWorld
// Try to overwrite existing record // Try to overwrite existing record
auto ret = mStatic.emplace(cell, pathgrid); auto ret = mStatic.emplace(cell, pathgrid);
if (!ret.second) if (!ret.second)
ret.first->second = pathgrid; ret.first->second = std::move(pathgrid);
return RecordId(ESM::RefId(), isDeleted); return RecordId(ESM::RefId(), isDeleted);
} }