1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-09 05:36:42 +00:00

Merge branch 'const_ret_val' into 'master'

Don't use `const` for objects returned by value.

See merge request OpenMW/openmw!1183
This commit is contained in:
Petr Mikheev 2021-09-04 12:41:52 +00:00
commit 76320aae45
5 changed files with 6 additions and 6 deletions

View file

@ -121,7 +121,7 @@ namespace CSMWorld
return SceneUtil::getActorSkeleton(firstPerson, mFemale, beast, werewolf); return SceneUtil::getActorSkeleton(firstPerson, mFemale, beast, werewolf);
} }
const std::string ActorAdapter::ActorData::getPart(ESM::PartReferenceType index) const const std::string& ActorAdapter::ActorData::getPart(ESM::PartReferenceType index) const
{ {
auto it = mParts.find(index); auto it = mParts.find(index);
if (it == mParts.end()) if (it == mParts.end())
@ -131,7 +131,7 @@ namespace CSMWorld
if (mFemale) if (mFemale)
{ {
// Note: we should use male parts for females as fallback // Note: we should use male parts for females as fallback
const std::string femalePart = mRaceData->getFemalePart(index); const std::string& femalePart = mRaceData->getFemalePart(index);
if (!femalePart.empty()) if (!femalePart.empty())
return femalePart; return femalePart;
} }

View file

@ -93,7 +93,7 @@ namespace CSMWorld
/// Returns the skeleton the actor should use for attaching parts to /// Returns the skeleton the actor should use for attaching parts to
std::string getSkeleton() const; std::string getSkeleton() const;
/// Retrieves the associated actor part /// Retrieves the associated actor part
const std::string getPart(ESM::PartReferenceType index) const; const std::string& getPart(ESM::PartReferenceType index) const;
/// Checks if the actor has a data dependency /// Checks if the actor has a data dependency
bool hasDependency(const std::string& id) const; bool hasDependency(const std::string& id) const;

View file

@ -521,7 +521,7 @@ std::string OMW::Engine::loadSettings (Settings::Manager & settings)
throw std::runtime_error ("No default settings file found! Make sure the file \"defaults.bin\" was properly installed."); throw std::runtime_error ("No default settings file found! Make sure the file \"defaults.bin\" was properly installed.");
// load user settings if they exist // load user settings if they exist
const std::string settingspath = (mCfgMgr.getUserConfigPath() / "settings.cfg").string(); std::string settingspath = (mCfgMgr.getUserConfigPath() / "settings.cfg").string();
if (boost::filesystem::exists(settingspath)) if (boost::filesystem::exists(settingspath))
settings.loadUser(settingspath); settings.loadUser(settingspath);

View file

@ -27,7 +27,7 @@ namespace DetourNavigator
std::optional<RemovedRecastMeshObject> CachedRecastMeshManager::removeObject(const ObjectId id) std::optional<RemovedRecastMeshObject> CachedRecastMeshManager::removeObject(const ObjectId id)
{ {
const auto object = mImpl.removeObject(id); auto object = mImpl.removeObject(id);
if (object) if (object)
mCached.lock()->reset(); mCached.lock()->reset();
return object; return object;

View file

@ -248,7 +248,7 @@ namespace DetourNavigator
const auto tile = tiles.find(tilePosition); const auto tile = tiles.find(tilePosition);
if (tile == tiles.end()) if (tile == tiles.end())
return std::optional<RemovedRecastMeshObject>(); return std::optional<RemovedRecastMeshObject>();
const auto tileResult = tile->second->removeObject(id); auto tileResult = tile->second->removeObject(id);
if (tile->second->isEmpty()) if (tile->second->isEmpty())
{ {
tiles.erase(tile); tiles.erase(tile);