From 0e54861455c558227f8a0f0f64fd6a0cffb27763 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 22 Mar 2020 00:56:00 -0400 Subject: [PATCH] General: Remove unnecessary std::move calls There's no real need to std::move a primitive type. A copy will be performed either way. We can remove std::move in this case to improve readability. --- Runtime/Particle/CModVectorElement.hpp | 6 ++-- Runtime/Particle/CParticleDataFactory.cpp | 36 +++++++++++------------ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Runtime/Particle/CModVectorElement.hpp b/Runtime/Particle/CModVectorElement.hpp index 53cb47670..d73dc0849 100644 --- a/Runtime/Particle/CModVectorElement.hpp +++ b/Runtime/Particle/CModVectorElement.hpp @@ -21,7 +21,7 @@ public: , x8_magScale(std::move(b)) , xc_maxMag(std::move(c)) , x10_minMag(std::move(d)) - , x14_enableMinMag(std::move(e)) {} + , x14_enableMinMag(e) {} bool GetValue(int frame, zeus::CVector3f& pVel, zeus::CVector3f& pPos) const override; }; @@ -39,7 +39,7 @@ public: , x8_magScale(std::move(b)) , xc_maxMag(std::move(c)) , x10_minMag(std::move(d)) - , x14_enableMinMag(std::move(e)) {} + , x14_enableMinMag(e) {} bool GetValue(int frame, zeus::CVector3f& pVel, zeus::CVector3f& pPos) const override; }; @@ -57,7 +57,7 @@ public: , x8_magScale(std::move(b)) , xc_maxMag(std::move(c)) , x10_minMag(std::move(d)) - , x14_enableMinMag(std::move(e)) {} + , x14_enableMinMag(e) {} bool GetValue(int frame, zeus::CVector3f& pVel, zeus::CVector3f& pPos) const override; }; diff --git a/Runtime/Particle/CParticleDataFactory.cpp b/Runtime/Particle/CParticleDataFactory.cpp index 1bed811b2..cf0b89f2b 100644 --- a/Runtime/Particle/CParticleDataFactory.cpp +++ b/Runtime/Particle/CParticleDataFactory.cpp @@ -88,19 +88,20 @@ std::unique_ptr CParticleDataFactory::GetTextureElement(CInputStream return std::make_unique(std::move(txtr)); } case SBIG('ATEX'): { - FourCC subId = GetClassID(in); - if (subId == SBIG('NONE')) + const FourCC subId = GetClassID(in); + if (subId == SBIG('NONE')) { return nullptr; - CAssetId id = in.readUint32Big(); + } + const CAssetId id = in.readUint32Big(); auto a = GetIntElement(in); auto b = GetIntElement(in); auto c = GetIntElement(in); auto d = GetIntElement(in); auto e = GetIntElement(in); - bool f = GetBool(in); + const bool f = GetBool(in); TToken txtr = resPool->GetObj({FOURCC('TXTR'), id}); return std::make_unique(std::move(txtr), std::move(std::move(a)), std::move(b), std::move(c), - std::move(d), std::move(e), std::move(f)); + std::move(d), std::move(e), f); } default: break; @@ -174,17 +175,16 @@ std::unique_ptr CParticleDataFactory::GetModVectorElement(CIn auto b = GetRealElement(in); auto c = GetRealElement(in); auto d = GetRealElement(in); - bool e = GetBool(in); - return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d), std::move(e)); + const bool e = GetBool(in); + return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d), e); } case SBIG('EMPL'): { auto a = GetVectorElement(in); auto b = GetRealElement(in); auto c = GetRealElement(in); auto d = GetRealElement(in); - bool e = GetBool(in); - return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d), - std::move(e)); + const bool e = GetBool(in); + return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d), e); } case SBIG('CHAN'): { auto a = GetModVectorElement(in); @@ -197,8 +197,8 @@ std::unique_ptr CParticleDataFactory::GetModVectorElement(CIn auto b = GetVectorElement(in); auto c = GetRealElement(in); auto d = GetRealElement(in); - bool e = GetBool(in); - return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d), std::move(e)); + const bool e = GetBool(in); + return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d), e); } case SBIG('CNST'): { auto a = GetRealElement(in); @@ -232,8 +232,8 @@ std::unique_ptr CParticleDataFactory::GetModVectorElement(CIn auto b = GetRealElement(in); auto c = GetRealElement(in); auto d = GetRealElement(in); - bool e = GetBool(in); - return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d), std::move(e)); + const bool e = GetBool(in); + return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d), e); } case SBIG('PULS'): { auto a = GetIntElement(in); @@ -424,8 +424,8 @@ std::unique_ptr CParticleDataFactory::GetRealElement(CInputStream& return std::make_unique(std::move(a), std::move(b)); } case SBIG('CNST'): { - float a = GetReal(in); - return std::make_unique(std::move(a)); + const float a = GetReal(in); + return std::make_unique(a); } case SBIG('CHAN'): { auto a = GetRealElement(in); @@ -628,8 +628,8 @@ std::unique_ptr CParticleDataFactory::GetIntElement(CInputStream& i return std::make_unique(std::move(a), std::move(b)); } case SBIG('CNST'): { - int a = GetInt(in); - return std::make_unique(std::move(a)); + const int a = GetInt(in); + return std::make_unique(a); } case SBIG('IMPL'): { auto a = GetIntElement(in);