1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-28 16:09:43 +00:00

Avoid redundant copies

This commit is contained in:
Andrei Kortunov 2023-12-06 23:45:25 +04:00
parent 0ff9831c92
commit 6f68df9ac2
7 changed files with 15 additions and 15 deletions

View file

@ -145,12 +145,12 @@ namespace
config.filterOutNonExistingPaths(dataDirs); config.filterOutNonExistingPaths(dataDirs);
const auto resDir = variables["resources"].as<Files::MaybeQuotedPath>(); const auto& resDir = variables["resources"].as<Files::MaybeQuotedPath>();
Log(Debug::Info) << Version::getOpenmwVersionDescription(); Log(Debug::Info) << Version::getOpenmwVersionDescription();
dataDirs.insert(dataDirs.begin(), resDir / "vfs"); dataDirs.insert(dataDirs.begin(), resDir / "vfs");
const auto fileCollections = Files::Collections(dataDirs); const Files::Collections fileCollections(dataDirs);
const auto archives = variables["fallback-archive"].as<StringsVector>(); const auto& archives = variables["fallback-archive"].as<StringsVector>();
const auto contentFiles = variables["content"].as<StringsVector>(); const auto& contentFiles = variables["content"].as<StringsVector>();
Fallback::Map::init(variables["fallback"].as<Fallback::FallbackMap>().mMap); Fallback::Map::init(variables["fallback"].as<Fallback::FallbackMap>().mMap);

View file

@ -156,7 +156,7 @@ Allowed options)");
return false; return false;
}*/ }*/
const auto inputFiles = variables["input-file"].as<Files::MaybeQuotedPathContainer>(); const auto& inputFiles = variables["input-file"].as<Files::MaybeQuotedPathContainer>();
info.filename = inputFiles[0].u8string(); // This call to u8string is redundant, but required to build on info.filename = inputFiles[0].u8string(); // This call to u8string is redundant, but required to build on
// MSVC 14.26 due to implementation bugs. // MSVC 14.26 due to implementation bugs.
if (inputFiles.size() > 1) if (inputFiles.size() > 1)

View file

@ -42,8 +42,8 @@ Allowed options)");
Files::ConfigurationManager cfgManager(true); Files::ConfigurationManager cfgManager(true);
cfgManager.readConfiguration(variables, desc); cfgManager.readConfiguration(variables, desc);
const auto essFile = variables["mwsave"].as<Files::MaybeQuotedPath>(); const auto& essFile = variables["mwsave"].as<Files::MaybeQuotedPath>();
const auto outputFile = variables["output"].as<Files::MaybeQuotedPath>(); const auto& outputFile = variables["output"].as<Files::MaybeQuotedPath>();
std::string encoding = variables["encoding"].as<std::string>(); std::string encoding = variables["encoding"].as<std::string>();
ESSImport::Importer importer(essFile, outputFile, encoding); ESSImport::Importer importer(essFile, outputFile, encoding);

View file

@ -164,12 +164,12 @@ namespace NavMeshTool
config.filterOutNonExistingPaths(dataDirs); config.filterOutNonExistingPaths(dataDirs);
const auto resDir = variables["resources"].as<Files::MaybeQuotedPath>(); const auto& resDir = variables["resources"].as<Files::MaybeQuotedPath>();
Log(Debug::Info) << Version::getOpenmwVersionDescription(); Log(Debug::Info) << Version::getOpenmwVersionDescription();
dataDirs.insert(dataDirs.begin(), resDir / "vfs"); dataDirs.insert(dataDirs.begin(), resDir / "vfs");
const auto fileCollections = Files::Collections(dataDirs); const Files::Collections fileCollections(dataDirs);
const auto archives = variables["fallback-archive"].as<StringsVector>(); const auto& archives = variables["fallback-archive"].as<StringsVector>();
const auto contentFiles = variables["content"].as<StringsVector>(); const auto& contentFiles = variables["content"].as<StringsVector>();
const std::size_t threadsNumber = variables["threads"].as<std::size_t>(); const std::size_t threadsNumber = variables["threads"].as<std::size_t>();
if (threadsNumber < 1) if (threadsNumber < 1)

View file

@ -92,7 +92,7 @@ void CSVWorld::DragRecordTable::dropEvent(QDropEvent* event)
if (CSVWorld::DragDropUtils::isTopicOrJournal(*event, display)) if (CSVWorld::DragDropUtils::isTopicOrJournal(*event, display))
{ {
const CSMWorld::TableMimeData* tableMimeData = CSVWorld::DragDropUtils::getTableMimeData(*event); const CSMWorld::TableMimeData* tableMimeData = CSVWorld::DragDropUtils::getTableMimeData(*event);
for (auto universalId : tableMimeData->getData()) for (const auto& universalId : tableMimeData->getData())
{ {
emit createNewInfoRecord(universalId.getId()); emit createNewInfoRecord(universalId.getId());
} }

View file

@ -839,7 +839,7 @@ namespace MWLua
// Note that, although this is member method of ActorActiveEffects and we are removing an effect (not a // Note that, although this is member method of ActorActiveEffects and we are removing an effect (not a
// spell), we still need to use the active spells store to purge this effect from active spells. // spell), we still need to use the active spells store to purge this effect from active spells.
auto ptr = effects.mActor.ptr(); const auto& ptr = effects.mActor.ptr();
auto& activeSpells = ptr.getClass().getCreatureStats(ptr).getActiveSpells(); auto& activeSpells = ptr.getClass().getCreatureStats(ptr).getActiveSpells();
activeSpells.purgeEffect(ptr, key.mId, key.mArg); activeSpells.purgeEffect(ptr, key.mId, key.mArg);

View file

@ -69,13 +69,13 @@ namespace
osg::Quat makeInverseNodeRotation(const MWWorld::Ptr& ptr) osg::Quat makeInverseNodeRotation(const MWWorld::Ptr& ptr)
{ {
const auto pos = ptr.getRefData().getPosition(); const auto& pos = ptr.getRefData().getPosition();
return ptr.getClass().isActor() ? makeActorOsgQuat(pos) : makeInversedOrderObjectOsgQuat(pos); return ptr.getClass().isActor() ? makeActorOsgQuat(pos) : makeInversedOrderObjectOsgQuat(pos);
} }
osg::Quat makeDirectNodeRotation(const MWWorld::Ptr& ptr) osg::Quat makeDirectNodeRotation(const MWWorld::Ptr& ptr)
{ {
const auto pos = ptr.getRefData().getPosition(); const auto& pos = ptr.getRefData().getPosition();
return ptr.getClass().isActor() ? makeActorOsgQuat(pos) : Misc::Convert::makeOsgQuat(pos); return ptr.getClass().isActor() ? makeActorOsgQuat(pos) : Misc::Convert::makeOsgQuat(pos);
} }