summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpsi29a <psi29a@gmail.com>2022-01-05 09:05:57 +0000
committerpsi29a <psi29a@gmail.com>2022-01-05 09:05:57 +0000
commit24b9c91ef83c4ae568d3842dbd756ad584907cbc (patch)
tree0e3d2b9da1b21117ce0d5958e0b0b375b963ceab
parent5eba352c9850cc6a64fcc8b6f55539e50aa82db6 (diff)
parent421e6629ad98f282dff032d82ad6cf682e26eba4 (diff)
Merge branch 'fix_copy_init' into 'master'
Fix unnecessary-copy-initialization See merge request OpenMW/openmw!1531
-rw-r--r--apps/openmw/mwgui/tooltips.cpp4
-rw-r--r--apps/openmw/mwmechanics/magiceffects.cpp2
-rw-r--r--apps/wizard/inisettings.cpp2
-rw-r--r--components/detournavigator/navigatorutils.cpp4
-rw-r--r--components/esm/esmreader.cpp2
5 files changed, 7 insertions, 7 deletions
diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp
index 0a2fd4c448..3a2bd65361 100644
--- a/apps/openmw/mwgui/tooltips.cpp
+++ b/apps/openmw/mwgui/tooltips.cpp
@@ -650,7 +650,7 @@ namespace MWGui
std::string ToolTips::getSoulString(const MWWorld::CellRef& cellref)
{
- std::string soul = cellref.getSoul();
+ const std::string& soul = cellref.getSoul();
if (soul.empty())
return std::string();
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
@@ -666,7 +666,7 @@ namespace MWGui
{
std::string ret;
ret += getMiscString(cellref.getOwner(), "Owner");
- const std::string factionId = cellref.getFaction();
+ const std::string& factionId = cellref.getFaction();
if (!factionId.empty())
{
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
diff --git a/apps/openmw/mwmechanics/magiceffects.cpp b/apps/openmw/mwmechanics/magiceffects.cpp
index 7a1acb1003..39d340e6ba 100644
--- a/apps/openmw/mwmechanics/magiceffects.cpp
+++ b/apps/openmw/mwmechanics/magiceffects.cpp
@@ -137,7 +137,7 @@ namespace MWMechanics
{
if (this==&effects)
{
- MagicEffects temp (effects);
+ const MagicEffects& temp (effects);
*this += temp;
return *this;
}
diff --git a/apps/wizard/inisettings.cpp b/apps/wizard/inisettings.cpp
index e9cec12f5f..198d1df6e7 100644
--- a/apps/wizard/inisettings.cpp
+++ b/apps/wizard/inisettings.cpp
@@ -122,7 +122,7 @@ bool Wizard::IniSettings::writeFile(const QString &path, QTextStream &stream)
QString section(fullKey.at(0));
section.prepend(QLatin1Char('['));
section.append(QLatin1Char(']'));
- QString key(fullKey.at(1));
+ const QString& key(fullKey.at(1));
int index = buffer.lastIndexOf(section);
if (index == -1) {
diff --git a/components/detournavigator/navigatorutils.cpp b/components/detournavigator/navigatorutils.cpp
index bc94e3f991..bfb0946b9e 100644
--- a/components/detournavigator/navigatorutils.cpp
+++ b/components/detournavigator/navigatorutils.cpp
@@ -11,7 +11,7 @@ namespace DetourNavigator
const auto navMesh = navigator.getNavMesh(agentHalfExtents);
if (!navMesh)
return std::nullopt;
- const auto settings = navigator.getSettings();
+ const auto& settings = navigator.getSettings();
const auto result = DetourNavigator::findRandomPointAroundCircle(navMesh->lockConst()->getImpl(),
toNavMeshCoordinates(settings.mRecast, agentHalfExtents), toNavMeshCoordinates(settings.mRecast, start),
toNavMeshCoordinates(settings.mRecast, maxRadius), includeFlags, settings.mDetour);
@@ -26,7 +26,7 @@ namespace DetourNavigator
const auto navMesh = navigator.getNavMesh(agentHalfExtents);
if (navMesh == nullptr)
return std::nullopt;
- const auto settings = navigator.getSettings();
+ const auto& settings = navigator.getSettings();
const auto result = DetourNavigator::raycast(navMesh->lockConst()->getImpl(),
toNavMeshCoordinates(settings.mRecast, agentHalfExtents), toNavMeshCoordinates(settings.mRecast, start),
toNavMeshCoordinates(settings.mRecast, end), includeFlags, settings.mDetour);
diff --git a/components/esm/esmreader.cpp b/components/esm/esmreader.cpp
index c84a1798ff..416e8a9be2 100644
--- a/components/esm/esmreader.cpp
+++ b/components/esm/esmreader.cpp
@@ -70,7 +70,7 @@ void ESMReader::resolveParentFileIndices(const std::vector<ESMReader>& allPlugin
const ESMReader& reader = allPlugins.at(i);
if (reader.getFileSize() == 0)
continue; // Content file in non-ESM format
- const std::string candidate = reader.getName();
+ const std::string& candidate = reader.getName();
std::string fnamecandidate = boost::filesystem::path(candidate).filename().string();
if (Misc::StringUtils::ciEqual(fname, fnamecandidate)) {
index = i;