From 66d1e036d2a4431d3e9779205bc1df4d69aff8f8 Mon Sep 17 00:00:00 2001
From: Andrei Kortunov <andrei.kortunov@yandex.ru>
Date: Tue, 30 Jan 2024 09:45:57 +0400
Subject: [PATCH] Pass some arguments by references

---
 apps/openmw/mwphysics/closestnotmerayresultcallback.cpp | 4 ++--
 apps/openmw/mwphysics/closestnotmerayresultcallback.hpp | 2 +-
 apps/openmw/mwstate/character.cpp                       | 4 ++--
 apps/openmw/mwstate/character.hpp                       | 2 +-
 apps/openmw/mwworld/projectilemanager.cpp               | 2 +-
 apps/openmw/mwworld/projectilemanager.hpp               | 2 +-
 components/widgets/sharedstatebutton.cpp                | 2 +-
 components/widgets/sharedstatebutton.hpp                | 2 +-
 8 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/apps/openmw/mwphysics/closestnotmerayresultcallback.cpp b/apps/openmw/mwphysics/closestnotmerayresultcallback.cpp
index 30a42bc3b8..875704d790 100644
--- a/apps/openmw/mwphysics/closestnotmerayresultcallback.cpp
+++ b/apps/openmw/mwphysics/closestnotmerayresultcallback.cpp
@@ -10,10 +10,10 @@
 namespace MWPhysics
 {
     ClosestNotMeRayResultCallback::ClosestNotMeRayResultCallback(const btCollisionObject* me,
-        std::vector<const btCollisionObject*> targets, const btVector3& from, const btVector3& to)
+        const std::vector<const btCollisionObject*>& targets, const btVector3& from, const btVector3& to)
         : btCollisionWorld::ClosestRayResultCallback(from, to)
         , mMe(me)
-        , mTargets(std::move(targets))
+        , mTargets(targets)
     {
     }
 
diff --git a/apps/openmw/mwphysics/closestnotmerayresultcallback.hpp b/apps/openmw/mwphysics/closestnotmerayresultcallback.hpp
index e6f5c45d36..37bda3bd52 100644
--- a/apps/openmw/mwphysics/closestnotmerayresultcallback.hpp
+++ b/apps/openmw/mwphysics/closestnotmerayresultcallback.hpp
@@ -14,7 +14,7 @@ namespace MWPhysics
     class ClosestNotMeRayResultCallback : public btCollisionWorld::ClosestRayResultCallback
     {
     public:
-        ClosestNotMeRayResultCallback(const btCollisionObject* me, std::vector<const btCollisionObject*> targets,
+        ClosestNotMeRayResultCallback(const btCollisionObject* me, const std::vector<const btCollisionObject*>& targets,
             const btVector3& from, const btVector3& to);
 
         btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace) override;
diff --git a/apps/openmw/mwstate/character.cpp b/apps/openmw/mwstate/character.cpp
index 85f5087fe6..9a3bc46742 100644
--- a/apps/openmw/mwstate/character.cpp
+++ b/apps/openmw/mwstate/character.cpp
@@ -84,8 +84,8 @@ void MWState::Character::addSlot(const ESM::SavedGame& profile)
     mSlots.push_back(slot);
 }
 
-MWState::Character::Character(std::filesystem::path saves, const std::string& game)
-    : mPath(std::move(saves))
+MWState::Character::Character(const std::filesystem::path& saves, const std::string& game)
+    : mPath(saves)
 {
     if (!std::filesystem::is_directory(mPath))
     {
diff --git a/apps/openmw/mwstate/character.hpp b/apps/openmw/mwstate/character.hpp
index 7b9eba2fee..3c68d9f490 100644
--- a/apps/openmw/mwstate/character.hpp
+++ b/apps/openmw/mwstate/character.hpp
@@ -32,7 +32,7 @@ namespace MWState
         void addSlot(const ESM::SavedGame& profile);
 
     public:
-        Character(std::filesystem::path saves, const std::string& game);
+        Character(const std::filesystem::path& saves, const std::string& game);
 
         void cleanup();
         ///< Delete the directory we used, if it is empty
diff --git a/apps/openmw/mwworld/projectilemanager.cpp b/apps/openmw/mwworld/projectilemanager.cpp
index 0584a9fe94..b25d138814 100644
--- a/apps/openmw/mwworld/projectilemanager.cpp
+++ b/apps/openmw/mwworld/projectilemanager.cpp
@@ -188,7 +188,7 @@ namespace MWWorld
     };
 
     void ProjectileManager::createModel(State& state, const std::string& model, const osg::Vec3f& pos,
-        const osg::Quat& orient, bool rotate, bool createLight, osg::Vec4 lightDiffuseColor, std::string texture)
+        const osg::Quat& orient, bool rotate, bool createLight, osg::Vec4 lightDiffuseColor, const std::string& texture)
     {
         state.mNode = new osg::PositionAttitudeTransform;
         state.mNode->setNodeMask(MWRender::Mask_Effect);
diff --git a/apps/openmw/mwworld/projectilemanager.hpp b/apps/openmw/mwworld/projectilemanager.hpp
index 65254a9110..012e3b5922 100644
--- a/apps/openmw/mwworld/projectilemanager.hpp
+++ b/apps/openmw/mwworld/projectilemanager.hpp
@@ -136,7 +136,7 @@ namespace MWWorld
         void moveMagicBolts(float dt);
 
         void createModel(State& state, const std::string& model, const osg::Vec3f& pos, const osg::Quat& orient,
-            bool rotate, bool createLight, osg::Vec4 lightDiffuseColor, std::string texture = "");
+            bool rotate, bool createLight, osg::Vec4 lightDiffuseColor, const std::string& texture = "");
         void update(State& state, float duration);
 
         void operator=(const ProjectileManager&);
diff --git a/components/widgets/sharedstatebutton.cpp b/components/widgets/sharedstatebutton.cpp
index ff24db1cfb..2d8070b0fb 100644
--- a/components/widgets/sharedstatebutton.cpp
+++ b/components/widgets/sharedstatebutton.cpp
@@ -116,7 +116,7 @@ namespace Gui
         }
     }
 
-    void SharedStateButton::createButtonGroup(ButtonGroup group)
+    void SharedStateButton::createButtonGroup(ButtonGroup& group)
     {
         for (ButtonGroup::iterator it = group.begin(); it != group.end(); ++it)
         {
diff --git a/components/widgets/sharedstatebutton.hpp b/components/widgets/sharedstatebutton.hpp
index 688d949f6e..33dd70c763 100644
--- a/components/widgets/sharedstatebutton.hpp
+++ b/components/widgets/sharedstatebutton.hpp
@@ -38,7 +38,7 @@ namespace Gui
         void shareStateWith(const ButtonGroup& shared);
 
         /// @note The ButtonGroup connection will be destroyed when any widget in the group gets destroyed.
-        static void createButtonGroup(ButtonGroup group);
+        static void createButtonGroup(ButtonGroup& group);
 
         //! Set button selected state
         void setStateSelected(bool _value);