1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-26 11:37:12 +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);
}
info.effects = list;
info.effects = std::move(list);
info.text = std::move(text);
info.isIngredient = true;

View File

@ -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) };
}
}
}

View File

@ -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());
}
}

View File

@ -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();
}
}

View File

@ -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) };
};
}
}

View File

@ -613,7 +613,7 @@ namespace MWLua
MWBase::Environment::get().getWorldModel()->registerPtr(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) {
@ -661,7 +661,7 @@ namespace MWLua
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))
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);
}

View File

@ -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);

View File

@ -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)

View File

@ -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

View File

@ -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);
}
}

View File

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

View File

@ -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;

View File

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

View File

@ -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);
}