From 1123dc46ee69e6bee7f2c6d96c4d4c0d58cc7608 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 23 Jun 2021 23:13:59 +0200 Subject: [PATCH] Add a ton of const refs --- apps/openmw/mwbase/mechanicsmanager.hpp | 2 +- apps/openmw/mwgui/dialogue.cpp | 2 +- apps/openmw/mwgui/dialogue.hpp | 2 +- apps/openmw/mwmechanics/activespells.cpp | 2 +- apps/openmw/mwmechanics/activespells.hpp | 2 +- apps/openmw/mwmechanics/disease.hpp | 2 +- apps/openmw/mwmechanics/mechanicsmanagerimp.cpp | 2 +- apps/openmw/mwmechanics/mechanicsmanagerimp.hpp | 2 +- apps/openmw/mwmechanics/pathfinding.hpp | 2 +- apps/openmw/mwmechanics/pickpocket.cpp | 2 +- apps/openmw/mwmechanics/pickpocket.hpp | 2 +- apps/openmw/mwmechanics/weapontype.cpp | 2 +- apps/openmw/mwmechanics/weapontype.hpp | 2 +- apps/openmw/mwphysics/physicssystem.cpp | 4 ++-- apps/openmw/mwphysics/physicssystem.hpp | 2 +- apps/openmw/mwphysics/projectile.cpp | 4 ++-- apps/openmw/mwphysics/projectile.hpp | 4 ++-- apps/openmw/mwphysics/raycasting.hpp | 2 +- apps/openmw/mwscript/interpretercontext.cpp | 2 +- apps/openmw/mwscript/interpretercontext.hpp | 2 +- apps/openmw/mwscript/statsextensions.cpp | 2 +- apps/openmw/mwworld/cellstore.cpp | 2 +- apps/openmw/mwworld/cellstore.hpp | 2 +- apps/openmw/mwworld/cellvisitors.hpp | 2 +- apps/openmw/mwworld/projectilemanager.cpp | 2 +- apps/openmw/mwworld/projectilemanager.hpp | 4 ++-- apps/openmw/mwworld/worldimp.cpp | 4 ++-- components/bsa/compressedbsafile.cpp | 2 +- components/bsa/compressedbsafile.hpp | 2 +- components/detournavigator/navmeshmanager.cpp | 2 +- components/detournavigator/navmeshmanager.hpp | 2 +- components/misc/stringops.hpp | 2 +- components/sceneutil/mwshadowtechnique.cpp | 2 +- components/sceneutil/osgacontroller.cpp | 4 ++-- components/sceneutil/osgacontroller.hpp | 4 ++-- components/sceneutil/util.cpp | 2 +- components/sceneutil/util.hpp | 2 +- components/shader/shadermanager.cpp | 2 +- 38 files changed, 45 insertions(+), 45 deletions(-) diff --git a/apps/openmw/mwbase/mechanicsmanager.hpp b/apps/openmw/mwbase/mechanicsmanager.hpp index 967504552d..3b0803e9be 100644 --- a/apps/openmw/mwbase/mechanicsmanager.hpp +++ b/apps/openmw/mwbase/mechanicsmanager.hpp @@ -88,7 +88,7 @@ namespace MWBase virtual void setPlayerClass (const ESM::Class& class_) = 0; ///< Set player class to custom class. - virtual void restoreDynamicStats(MWWorld::Ptr actor, double hours, bool sleep) = 0; + virtual void restoreDynamicStats(const MWWorld::Ptr& actor, double hours, bool sleep) = 0; virtual void rest(double hours, bool sleep) = 0; ///< If the player is sleeping or waiting, this should be called every hour. diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp index 0fda54ebab..93180adad2 100644 --- a/apps/openmw/mwgui/dialogue.cpp +++ b/apps/openmw/mwgui/dialogue.cpp @@ -488,7 +488,7 @@ namespace MWGui mHistoryContents.clear(); } - bool DialogueWindow::setKeywords(std::list keyWords) + bool DialogueWindow::setKeywords(const std::list& keyWords) { if (mKeywords == keyWords && isCompanion() == mIsCompanion) return false; diff --git a/apps/openmw/mwgui/dialogue.hpp b/apps/openmw/mwgui/dialogue.hpp index ac6303e20a..aff09c0211 100644 --- a/apps/openmw/mwgui/dialogue.hpp +++ b/apps/openmw/mwgui/dialogue.hpp @@ -118,7 +118,7 @@ namespace MWGui void setPtr(const MWWorld::Ptr& actor) override; /// @return true if stale keywords were updated successfully - bool setKeywords(std::list keyWord); + bool setKeywords(const std::list& keyWord); void addResponse (const std::string& title, const std::string& text, bool needMargin = true); diff --git a/apps/openmw/mwmechanics/activespells.cpp b/apps/openmw/mwmechanics/activespells.cpp index 928293e649..319d797257 100644 --- a/apps/openmw/mwmechanics/activespells.cpp +++ b/apps/openmw/mwmechanics/activespells.cpp @@ -140,7 +140,7 @@ namespace MWMechanics return mSpells; } - void ActiveSpells::addSpell(const std::string &id, bool stack, std::vector effects, + void ActiveSpells::addSpell(const std::string &id, bool stack, const std::vector& effects, const std::string &displayName, int casterActorId) { TContainer::iterator it(mSpells.find(id)); diff --git a/apps/openmw/mwmechanics/activespells.hpp b/apps/openmw/mwmechanics/activespells.hpp index 54f662fc26..8bc29aa444 100644 --- a/apps/openmw/mwmechanics/activespells.hpp +++ b/apps/openmw/mwmechanics/activespells.hpp @@ -74,7 +74,7 @@ namespace MWMechanics /// \param effects /// \param displayName Name for display in magic menu. /// - void addSpell (const std::string& id, bool stack, std::vector effects, + void addSpell (const std::string& id, bool stack, const std::vector& effects, const std::string& displayName, int casterActorId); /// Removes the active effects from this spell/potion/.. with \a id diff --git a/apps/openmw/mwmechanics/disease.hpp b/apps/openmw/mwmechanics/disease.hpp index 7933c927e5..5d4bfb682f 100644 --- a/apps/openmw/mwmechanics/disease.hpp +++ b/apps/openmw/mwmechanics/disease.hpp @@ -21,7 +21,7 @@ namespace MWMechanics /// Call when \a actor has got in contact with \a carrier (e.g. hit by him, or loots him) /// @param actor The actor that will potentially catch diseases. Currently only the player can catch diseases. /// @param carrier The disease carrier. - inline void diseaseContact (MWWorld::Ptr actor, MWWorld::Ptr carrier) + inline void diseaseContact (const MWWorld::Ptr& actor, const MWWorld::Ptr& carrier) { if (!carrier.getClass().isActor() || actor != getPlayer()) return; diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index 7101139821..0d7dd187f7 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -402,7 +402,7 @@ namespace MWMechanics mActors.rest(hours, sleep); } - void MechanicsManager::restoreDynamicStats(MWWorld::Ptr actor, double hours, bool sleep) + void MechanicsManager::restoreDynamicStats(const MWWorld::Ptr& actor, double hours, bool sleep) { mActors.restoreDynamicStats(actor, hours, sleep); } diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp index 3f2c3f5e98..72eb044fa0 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp @@ -75,7 +75,7 @@ namespace MWMechanics void setPlayerClass (const ESM::Class& class_) override; ///< Set player class to custom class. - void restoreDynamicStats(MWWorld::Ptr actor, double hours, bool sleep) override; + void restoreDynamicStats(const MWWorld::Ptr& actor, double hours, bool sleep) override; void rest(double hours, bool sleep) override; ///< If the player is sleeping or waiting, this should be called every hour. diff --git a/apps/openmw/mwmechanics/pathfinding.hpp b/apps/openmw/mwmechanics/pathfinding.hpp index 987f2c6603..aa6a79c4eb 100644 --- a/apps/openmw/mwmechanics/pathfinding.hpp +++ b/apps/openmw/mwmechanics/pathfinding.hpp @@ -167,7 +167,7 @@ namespace MWMechanics // Caller needs to be careful for very short distances (i.e. less than 1) // or when accumuating the results i.e. (a + b)^2 != a^2 + b^2 // - static float distanceSquared(ESM::Pathgrid::Point point, const osg::Vec3f& pos) + static float distanceSquared(const ESM::Pathgrid::Point& point, const osg::Vec3f& pos) { return (MWMechanics::PathFinder::makeOsgVec3(point) - pos).length2(); } diff --git a/apps/openmw/mwmechanics/pickpocket.cpp b/apps/openmw/mwmechanics/pickpocket.cpp index 05e8a03930..038753f7d1 100644 --- a/apps/openmw/mwmechanics/pickpocket.cpp +++ b/apps/openmw/mwmechanics/pickpocket.cpp @@ -53,7 +53,7 @@ namespace MWMechanics } } - bool Pickpocket::pick(MWWorld::Ptr item, int count) + bool Pickpocket::pick(const MWWorld::Ptr& item, int count) { float stackValue = static_cast(item.getClass().getValue(item) * count); float fPickPocketMod = MWBase::Environment::get().getWorld()->getStore().get() diff --git a/apps/openmw/mwmechanics/pickpocket.hpp b/apps/openmw/mwmechanics/pickpocket.hpp index 4de1e37f84..0957b7a680 100644 --- a/apps/openmw/mwmechanics/pickpocket.hpp +++ b/apps/openmw/mwmechanics/pickpocket.hpp @@ -13,7 +13,7 @@ namespace MWMechanics /// Steal some items /// @return Was the thief detected? - bool pick (MWWorld::Ptr item, int count); + bool pick (const MWWorld::Ptr& item, int count); /// End the pickpocketing process /// @return Was the thief detected? bool finish (); diff --git a/apps/openmw/mwmechanics/weapontype.cpp b/apps/openmw/mwmechanics/weapontype.cpp index 2f8e45f7ff..feecd468ad 100644 --- a/apps/openmw/mwmechanics/weapontype.cpp +++ b/apps/openmw/mwmechanics/weapontype.cpp @@ -4,7 +4,7 @@ namespace MWMechanics { - MWWorld::ContainerStoreIterator getActiveWeapon(MWWorld::Ptr actor, int *weaptype) + MWWorld::ContainerStoreIterator getActiveWeapon(const MWWorld::Ptr& actor, int *weaptype) { MWWorld::InventoryStore &inv = actor.getClass().getInventoryStore(actor); CreatureStats &stats = actor.getClass().getCreatureStats(actor); diff --git a/apps/openmw/mwmechanics/weapontype.hpp b/apps/openmw/mwmechanics/weapontype.hpp index 09fa73c065..4d10e9b1c5 100644 --- a/apps/openmw/mwmechanics/weapontype.hpp +++ b/apps/openmw/mwmechanics/weapontype.hpp @@ -261,7 +261,7 @@ namespace MWMechanics } }; - MWWorld::ContainerStoreIterator getActiveWeapon(MWWorld::Ptr actor, int *weaptype); + MWWorld::ContainerStoreIterator getActiveWeapon(const MWWorld::Ptr& actor, int *weaptype); const ESM::WeaponType* getWeaponType(const int weaponType); } diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index 833bb9a161..091d8b1612 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -261,7 +261,7 @@ namespace MWPhysics return 0.f; } - RayCastingResult PhysicsSystem::castRay(const osg::Vec3f &from, const osg::Vec3f &to, const MWWorld::ConstPtr& ignore, std::vector targets, int mask, int group) const + RayCastingResult PhysicsSystem::castRay(const osg::Vec3f &from, const osg::Vec3f &to, const MWWorld::ConstPtr& ignore, const std::vector& targets, int mask, int group) const { if (from == to) { @@ -290,7 +290,7 @@ namespace MWPhysics if (!targets.empty()) { - for (MWWorld::Ptr& target : targets) + for (const MWWorld::Ptr& target : targets) { const Actor* actor = getActor(target); if (actor) diff --git a/apps/openmw/mwphysics/physicssystem.hpp b/apps/openmw/mwphysics/physicssystem.hpp index 3d2a3c580d..bd50bd915a 100644 --- a/apps/openmw/mwphysics/physicssystem.hpp +++ b/apps/openmw/mwphysics/physicssystem.hpp @@ -175,7 +175,7 @@ namespace MWPhysics /// @param me Optional, a Ptr to ignore in the list of results. targets are actors to filter for, ignoring all other actors. RayCastingResult castRay(const osg::Vec3f &from, const osg::Vec3f &to, const MWWorld::ConstPtr& ignore = MWWorld::ConstPtr(), - std::vector targets = std::vector(), + const std::vector& targets = std::vector(), int mask = CollisionType_World|CollisionType_HeightMap|CollisionType_Actor|CollisionType_Door, int group=0xff) const override; RayCastingResult castSphere(const osg::Vec3f& from, const osg::Vec3f& to, float radius) const override; diff --git a/apps/openmw/mwphysics/projectile.cpp b/apps/openmw/mwphysics/projectile.cpp index 252da0a687..0a6e9ac123 100644 --- a/apps/openmw/mwphysics/projectile.cpp +++ b/apps/openmw/mwphysics/projectile.cpp @@ -78,7 +78,7 @@ bool Projectile::canTraverseWater() const return mCanCrossWaterSurface; } -void Projectile::hit(MWWorld::Ptr target, btVector3 pos, btVector3 normal) +void Projectile::hit(const MWWorld::Ptr& target, btVector3 pos, btVector3 normal) { if (!mActive.load(std::memory_order_acquire)) return; @@ -95,7 +95,7 @@ MWWorld::Ptr Projectile::getCaster() const return mCaster; } -void Projectile::setCaster(MWWorld::Ptr caster) +void Projectile::setCaster(const MWWorld::Ptr& caster) { std::scoped_lock lock(mMutex); mCaster = caster; diff --git a/apps/openmw/mwphysics/projectile.hpp b/apps/openmw/mwphysics/projectile.hpp index 81c33d2a5e..7bcf33b38d 100644 --- a/apps/openmw/mwphysics/projectile.hpp +++ b/apps/openmw/mwphysics/projectile.hpp @@ -58,11 +58,11 @@ namespace MWPhysics } MWWorld::Ptr getCaster() const; - void setCaster(MWWorld::Ptr caster); + void setCaster(const MWWorld::Ptr& caster); bool canTraverseWater() const; - void hit(MWWorld::Ptr target, btVector3 pos, btVector3 normal); + void hit(const MWWorld::Ptr& target, btVector3 pos, btVector3 normal); void setValidTargets(const std::vector& targets); bool isValidTarget(const MWWorld::Ptr& target) const; diff --git a/apps/openmw/mwphysics/raycasting.hpp b/apps/openmw/mwphysics/raycasting.hpp index 7c8375cb5a..e13e745fec 100644 --- a/apps/openmw/mwphysics/raycasting.hpp +++ b/apps/openmw/mwphysics/raycasting.hpp @@ -28,7 +28,7 @@ namespace MWPhysics /// @param me Optional, a Ptr to ignore in the list of results. targets are actors to filter for, ignoring all other actors. virtual RayCastingResult castRay(const osg::Vec3f &from, const osg::Vec3f &to, const MWWorld::ConstPtr& ignore = MWWorld::ConstPtr(), - std::vector targets = std::vector(), + const std::vector& targets = std::vector(), int mask = CollisionType_World|CollisionType_HeightMap|CollisionType_Actor|CollisionType_Door, int group=0xff) const = 0; virtual RayCastingResult castSphere(const osg::Vec3f& from, const osg::Vec3f& to, float radius) const = 0; diff --git a/apps/openmw/mwscript/interpretercontext.cpp b/apps/openmw/mwscript/interpretercontext.cpp index 2e8f72e629..6d7dcdda1d 100644 --- a/apps/openmw/mwscript/interpretercontext.cpp +++ b/apps/openmw/mwscript/interpretercontext.cpp @@ -415,7 +415,7 @@ namespace MWScript return MWBase::Environment::get().getWorld()->getCellName(); } - void InterpreterContext::executeActivation(MWWorld::Ptr ptr, MWWorld::Ptr actor) + void InterpreterContext::executeActivation(const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) { std::shared_ptr action = (ptr.getClass().activate(ptr, actor)); action->execute (actor); diff --git a/apps/openmw/mwscript/interpretercontext.hpp b/apps/openmw/mwscript/interpretercontext.hpp index 84982f6356..ee40883eac 100644 --- a/apps/openmw/mwscript/interpretercontext.hpp +++ b/apps/openmw/mwscript/interpretercontext.hpp @@ -111,7 +111,7 @@ namespace MWScript std::string getCurrentCellName() const override; - void executeActivation(MWWorld::Ptr ptr, MWWorld::Ptr actor); + void executeActivation(const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor); ///< Execute the activation action for this ptr. If ptr is mActivated, mark activation as handled. int getMemberShort (const std::string& id, const std::string& name, bool global) const override; diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp index ab3287c9a4..073312f538 100644 --- a/apps/openmw/mwscript/statsextensions.cpp +++ b/apps/openmw/mwscript/statsextensions.cpp @@ -31,7 +31,7 @@ namespace { - std::string getDialogueActorFaction(MWWorld::ConstPtr actor) + std::string getDialogueActorFaction(const MWWorld::ConstPtr& actor) { std::string factionId = actor.getClass().getPrimaryFaction(actor); if (factionId.empty()) diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index 2e2735e11a..051273f21d 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -1162,7 +1162,7 @@ namespace MWWorld update(mBooks.mList); } - void MWWorld::CellStore::checkItem(Ptr ptr) + void MWWorld::CellStore::checkItem(const Ptr& ptr) { if (ptr.getClass().getEnchantment(ptr).empty()) return; diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index edd8577ae0..6e927fbea6 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -127,7 +127,7 @@ namespace MWWorld void updateRechargingItems(); void rechargeItems(float duration); - void checkItem(Ptr ptr); + void checkItem(const Ptr& ptr); // helper function for forEachInternal template diff --git a/apps/openmw/mwworld/cellvisitors.hpp b/apps/openmw/mwworld/cellvisitors.hpp index e68b383b77..99bbebc126 100644 --- a/apps/openmw/mwworld/cellvisitors.hpp +++ b/apps/openmw/mwworld/cellvisitors.hpp @@ -13,7 +13,7 @@ namespace MWWorld { std::vector mObjects; - bool operator() (MWWorld::Ptr ptr) + bool operator() (const MWWorld::Ptr& ptr) { if (ptr.getRefData().getBaseNode()) { diff --git a/apps/openmw/mwworld/projectilemanager.cpp b/apps/openmw/mwworld/projectilemanager.cpp index 4f0a2098f0..439f5a4605 100644 --- a/apps/openmw/mwworld/projectilemanager.cpp +++ b/apps/openmw/mwworld/projectilemanager.cpp @@ -325,7 +325,7 @@ namespace MWWorld mMagicBolts.push_back(state); } - void ProjectileManager::launchProjectile(Ptr actor, ConstPtr projectile, const osg::Vec3f &pos, const osg::Quat &orient, Ptr bow, float speed, float attackStrength) + void ProjectileManager::launchProjectile(const Ptr& actor, const ConstPtr& projectile, const osg::Vec3f &pos, const osg::Quat &orient, const Ptr& bow, float speed, float attackStrength) { ProjectileState state; state.mActorId = actor.getClass().getCreatureStats(actor).getActorId(); diff --git a/apps/openmw/mwworld/projectilemanager.hpp b/apps/openmw/mwworld/projectilemanager.hpp index e4bcae1ae4..4dc250dc5f 100644 --- a/apps/openmw/mwworld/projectilemanager.hpp +++ b/apps/openmw/mwworld/projectilemanager.hpp @@ -51,8 +51,8 @@ namespace MWWorld /// If caster is an actor, the actor's facing orientation is used. Otherwise fallbackDirection is used. void launchMagicBolt (const std::string &spellId, const MWWorld::Ptr& caster, const osg::Vec3f& fallbackDirection); - void launchProjectile (MWWorld::Ptr actor, MWWorld::ConstPtr projectile, - const osg::Vec3f& pos, const osg::Quat& orient, MWWorld::Ptr bow, float speed, float attackStrength); + void launchProjectile (const MWWorld::Ptr& actor, const MWWorld::ConstPtr& projectile, + const osg::Vec3f& pos, const osg::Quat& orient, const MWWorld::Ptr& bow, float speed, float attackStrength); void updateCasters(); diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 611e535c88..8a0bd46f27 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -753,7 +753,7 @@ namespace MWWorld FindContainerVisitor(const ConstPtr& containedPtr) : mContainedPtr(containedPtr) {} - bool operator() (Ptr ptr) + bool operator() (const Ptr& ptr) { if (mContainedPtr.getContainerStore() == &ptr.getClass().getContainerStore(ptr)) { @@ -3836,7 +3836,7 @@ namespace MWWorld struct ResetActorsVisitor { - bool operator() (Ptr ptr) + bool operator() (const Ptr& ptr) { if (ptr.getClass().isActor() && ptr.getCellRef().hasContentFile()) { diff --git a/components/bsa/compressedbsafile.cpp b/components/bsa/compressedbsafile.cpp index 09a05d2f5f..f066489184 100644 --- a/components/bsa/compressedbsafile.cpp +++ b/components/bsa/compressedbsafile.cpp @@ -406,7 +406,7 @@ Files::IStreamPtr CompressedBSAFile::getFile(const FileRecord& fileRecord) return std::shared_ptr(memoryStreamPtr, (std::istream*)memoryStreamPtr.get()); } -BsaVersion CompressedBSAFile::detectVersion(std::string filePath) +BsaVersion CompressedBSAFile::detectVersion(const std::string& filePath) { namespace bfs = boost::filesystem; bfs::ifstream input(bfs::path(filePath), std::ios_base::binary); diff --git a/components/bsa/compressedbsafile.hpp b/components/bsa/compressedbsafile.hpp index 215a1fc494..ac6e6fdf78 100644 --- a/components/bsa/compressedbsafile.hpp +++ b/components/bsa/compressedbsafile.hpp @@ -87,7 +87,7 @@ namespace Bsa virtual ~CompressedBSAFile(); //checks version of BSA from file header - static BsaVersion detectVersion(std::string filePath); + static BsaVersion detectVersion(const std::string& filePath); /// Read header information from the input source void readHeader() override; diff --git a/components/detournavigator/navmeshmanager.cpp b/components/detournavigator/navmeshmanager.cpp index de4c21c68a..c42fb5c4be 100644 --- a/components/detournavigator/navmeshmanager.cpp +++ b/components/detournavigator/navmeshmanager.cpp @@ -133,7 +133,7 @@ namespace DetourNavigator addChangedTile(tile, ChangeType::update); } - void NavMeshManager::update(osg::Vec3f playerPosition, const osg::Vec3f& agentHalfExtents) + void NavMeshManager::update(const osg::Vec3f& playerPosition, const osg::Vec3f& agentHalfExtents) { const auto playerTile = getTilePosition(mSettings, toNavMeshCoordinates(mSettings, playerPosition)); auto& lastRevision = mLastRecastMeshManagerRevision[agentHalfExtents]; diff --git a/components/detournavigator/navmeshmanager.hpp b/components/detournavigator/navmeshmanager.hpp index 760ddb6b30..b176515e3b 100644 --- a/components/detournavigator/navmeshmanager.hpp +++ b/components/detournavigator/navmeshmanager.hpp @@ -43,7 +43,7 @@ namespace DetourNavigator void removeOffMeshConnections(const ObjectId id); - void update(osg::Vec3f playerPosition, const osg::Vec3f& agentHalfExtents); + void update(const osg::Vec3f& playerPosition, const osg::Vec3f& agentHalfExtents); void wait(Loading::Listener& listener, WaitConditionType waitConditionType); diff --git a/components/misc/stringops.hpp b/components/misc/stringops.hpp index 48deaa9991..41effafa88 100644 --- a/components/misc/stringops.hpp +++ b/components/misc/stringops.hpp @@ -279,7 +279,7 @@ public: // TODO: use the std::string_view once we will use the C++17. // It should allow us to avoid data copying while we still will support both string and literal arguments. - static inline void replaceAll(std::string& data, std::string toSearch, std::string replaceStr) + static inline void replaceAll(std::string& data, const std::string& toSearch, const std::string& replaceStr) { size_t pos = data.find(toSearch); diff --git a/components/sceneutil/mwshadowtechnique.cpp b/components/sceneutil/mwshadowtechnique.cpp index 88d44d2f69..9209532f7e 100644 --- a/components/sceneutil/mwshadowtechnique.cpp +++ b/components/sceneutil/mwshadowtechnique.cpp @@ -1996,7 +1996,7 @@ struct ConvexHull } }; - Vertices findInternalEdges(osg::Vec3d mainVertex, Vertices connectedVertices) + Vertices findInternalEdges(const osg::Vec3d& mainVertex, const Vertices& connectedVertices) { Vertices internalEdgeVertices; for (const auto& vertex : connectedVertices) diff --git a/components/sceneutil/osgacontroller.cpp b/components/sceneutil/osgacontroller.cpp index b2d819117f..02c9558ab3 100644 --- a/components/sceneutil/osgacontroller.cpp +++ b/components/sceneutil/osgacontroller.cpp @@ -153,7 +153,7 @@ namespace SceneUtil return osg::Vec3f(); } - void OsgAnimationController::update(float time, std::string animationName) + void OsgAnimationController::update(float time, const std::string& animationName) { for (const auto& mergedAnimationTrack : mMergedAnimationTracks) { @@ -190,7 +190,7 @@ namespace SceneUtil traverse(node, nv); } - void OsgAnimationController::setEmulatedAnimations(std::vector emulatedAnimations) + void OsgAnimationController::setEmulatedAnimations(const std::vector& emulatedAnimations) { mEmulatedAnimations = emulatedAnimations; } diff --git a/components/sceneutil/osgacontroller.hpp b/components/sceneutil/osgacontroller.hpp index f1c1584c2a..46538fa813 100644 --- a/components/sceneutil/osgacontroller.hpp +++ b/components/sceneutil/osgacontroller.hpp @@ -58,13 +58,13 @@ namespace SceneUtil osg::Vec3f getTranslation(float time) const override; /// @brief Calls animation track update() - void update(float time, std::string animationName); + void update(float time, const std::string& animationName); /// @brief Called every frame for osgAnimation void operator() (osg::Node*, osg::NodeVisitor*) override; /// @brief Sets details of the animations - void setEmulatedAnimations(std::vector emulatedAnimations); + void setEmulatedAnimations(const std::vector& emulatedAnimations); /// @brief Adds an animation track to a model void addMergedAnimationTrack(osg::ref_ptr animationTrack); diff --git a/components/sceneutil/util.cpp b/components/sceneutil/util.cpp index 1fe3685726..fb5264e224 100644 --- a/components/sceneutil/util.cpp +++ b/components/sceneutil/util.cpp @@ -218,7 +218,7 @@ bool hasUserDescription(const osg::Node* node, const std::string pattern) return false; } -osg::ref_ptr addEnchantedGlow(osg::ref_ptr node, Resource::ResourceSystem* resourceSystem, osg::Vec4f glowColor, float glowDuration) +osg::ref_ptr addEnchantedGlow(osg::ref_ptr node, Resource::ResourceSystem* resourceSystem, const osg::Vec4f& glowColor, float glowDuration) { std::vector > textures; for (int i=0; i<32; ++i) diff --git a/components/sceneutil/util.hpp b/components/sceneutil/util.hpp index 8103ed87a8..72a368b06a 100644 --- a/components/sceneutil/util.hpp +++ b/components/sceneutil/util.hpp @@ -60,7 +60,7 @@ namespace SceneUtil bool hasUserDescription(const osg::Node* node, const std::string pattern); - osg::ref_ptr addEnchantedGlow(osg::ref_ptr node, Resource::ResourceSystem* resourceSystem, osg::Vec4f glowColor, float glowDuration=-1); + osg::ref_ptr addEnchantedGlow(osg::ref_ptr node, Resource::ResourceSystem* resourceSystem, const osg::Vec4f& glowColor, float glowDuration=-1); // Alpha-to-coverage requires a multisampled framebuffer, so we need to set that up for RTTs bool attachAlphaToCoverageFriendlyFramebufferToCamera(osg::Camera* camera, osg::Camera::BufferComponent buffer, osg::Texture* texture, unsigned int level = 0, unsigned int face = 0, bool mipMapGeneration = false); diff --git a/components/shader/shadermanager.cpp b/components/shader/shadermanager.cpp index 1635d13db7..9b057cdfc6 100644 --- a/components/shader/shadermanager.cpp +++ b/components/shader/shadermanager.cpp @@ -75,7 +75,7 @@ namespace Shader // Recursively replaces include statements with the actual source of the included files. // Adjusts #line statements accordingly and detects cyclic includes. // includingFiles is the set of files that include this file directly or indirectly, and is intentionally not a reference to allow automatic cleanup. - static bool parseIncludes(boost::filesystem::path shaderPath, std::string& source, const std::string& fileName, int& fileNumber, std::set includingFiles) + static bool parseIncludes(const boost::filesystem::path& shaderPath, std::string& source, const std::string& fileName, int& fileNumber, std::set includingFiles) { // An include is cyclic if it is being included by itself if (includingFiles.insert(shaderPath/fileName).second == false)