mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-29 22:20:33 +00:00
Fix unnecessary-copy-initialization
> warning: the variable 'key' is copy-constructed from a const reference but is only used as const reference; consider making it a const reference [performance-unnecessary-copy-initialization] Found by clang-tidy.
This commit is contained in:
parent
b6572fbe42
commit
421e6629ad
@ -650,7 +650,7 @@ namespace MWGui
|
|||||||
|
|
||||||
std::string ToolTips::getSoulString(const MWWorld::CellRef& cellref)
|
std::string ToolTips::getSoulString(const MWWorld::CellRef& cellref)
|
||||||
{
|
{
|
||||||
std::string soul = cellref.getSoul();
|
const std::string& soul = cellref.getSoul();
|
||||||
if (soul.empty())
|
if (soul.empty())
|
||||||
return std::string();
|
return std::string();
|
||||||
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
@ -666,7 +666,7 @@ namespace MWGui
|
|||||||
{
|
{
|
||||||
std::string ret;
|
std::string ret;
|
||||||
ret += getMiscString(cellref.getOwner(), "Owner");
|
ret += getMiscString(cellref.getOwner(), "Owner");
|
||||||
const std::string factionId = cellref.getFaction();
|
const std::string& factionId = cellref.getFaction();
|
||||||
if (!factionId.empty())
|
if (!factionId.empty())
|
||||||
{
|
{
|
||||||
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
@ -137,7 +137,7 @@ namespace MWMechanics
|
|||||||
{
|
{
|
||||||
if (this==&effects)
|
if (this==&effects)
|
||||||
{
|
{
|
||||||
MagicEffects temp (effects);
|
const MagicEffects& temp (effects);
|
||||||
*this += temp;
|
*this += temp;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ bool Wizard::IniSettings::writeFile(const QString &path, QTextStream &stream)
|
|||||||
QString section(fullKey.at(0));
|
QString section(fullKey.at(0));
|
||||||
section.prepend(QLatin1Char('['));
|
section.prepend(QLatin1Char('['));
|
||||||
section.append(QLatin1Char(']'));
|
section.append(QLatin1Char(']'));
|
||||||
QString key(fullKey.at(1));
|
const QString& key(fullKey.at(1));
|
||||||
|
|
||||||
int index = buffer.lastIndexOf(section);
|
int index = buffer.lastIndexOf(section);
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
|
@ -11,7 +11,7 @@ namespace DetourNavigator
|
|||||||
const auto navMesh = navigator.getNavMesh(agentHalfExtents);
|
const auto navMesh = navigator.getNavMesh(agentHalfExtents);
|
||||||
if (!navMesh)
|
if (!navMesh)
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
const auto settings = navigator.getSettings();
|
const auto& settings = navigator.getSettings();
|
||||||
const auto result = DetourNavigator::findRandomPointAroundCircle(navMesh->lockConst()->getImpl(),
|
const auto result = DetourNavigator::findRandomPointAroundCircle(navMesh->lockConst()->getImpl(),
|
||||||
toNavMeshCoordinates(settings.mRecast, agentHalfExtents), toNavMeshCoordinates(settings.mRecast, start),
|
toNavMeshCoordinates(settings.mRecast, agentHalfExtents), toNavMeshCoordinates(settings.mRecast, start),
|
||||||
toNavMeshCoordinates(settings.mRecast, maxRadius), includeFlags, settings.mDetour);
|
toNavMeshCoordinates(settings.mRecast, maxRadius), includeFlags, settings.mDetour);
|
||||||
@ -26,7 +26,7 @@ namespace DetourNavigator
|
|||||||
const auto navMesh = navigator.getNavMesh(agentHalfExtents);
|
const auto navMesh = navigator.getNavMesh(agentHalfExtents);
|
||||||
if (navMesh == nullptr)
|
if (navMesh == nullptr)
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
const auto settings = navigator.getSettings();
|
const auto& settings = navigator.getSettings();
|
||||||
const auto result = DetourNavigator::raycast(navMesh->lockConst()->getImpl(),
|
const auto result = DetourNavigator::raycast(navMesh->lockConst()->getImpl(),
|
||||||
toNavMeshCoordinates(settings.mRecast, agentHalfExtents), toNavMeshCoordinates(settings.mRecast, start),
|
toNavMeshCoordinates(settings.mRecast, agentHalfExtents), toNavMeshCoordinates(settings.mRecast, start),
|
||||||
toNavMeshCoordinates(settings.mRecast, end), includeFlags, settings.mDetour);
|
toNavMeshCoordinates(settings.mRecast, end), includeFlags, settings.mDetour);
|
||||||
|
@ -70,7 +70,7 @@ void ESMReader::resolveParentFileIndices(const std::vector<ESMReader>& allPlugin
|
|||||||
const ESMReader& reader = allPlugins.at(i);
|
const ESMReader& reader = allPlugins.at(i);
|
||||||
if (reader.getFileSize() == 0)
|
if (reader.getFileSize() == 0)
|
||||||
continue; // Content file in non-ESM format
|
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();
|
std::string fnamecandidate = boost::filesystem::path(candidate).filename().string();
|
||||||
if (Misc::StringUtils::ciEqual(fname, fnamecandidate)) {
|
if (Misc::StringUtils::ciEqual(fname, fnamecandidate)) {
|
||||||
index = i;
|
index = i;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user