From 280e4ce07d8b19ff4a5091b2d553da96ef98b489 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 9 Mar 2020 11:06:17 -0400 Subject: [PATCH 01/11] CAnimTreeAnimReaderContainer: std::move shared_ptr in constructor Provides the same behavior, but without a redundant atomic reference count increment and decrement. --- Runtime/Character/CAnimTreeAnimReaderContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Runtime/Character/CAnimTreeAnimReaderContainer.cpp b/Runtime/Character/CAnimTreeAnimReaderContainer.cpp index 16661690b..a7105b6ab 100644 --- a/Runtime/Character/CAnimTreeAnimReaderContainer.cpp +++ b/Runtime/Character/CAnimTreeAnimReaderContainer.cpp @@ -6,7 +6,7 @@ namespace urde { CAnimTreeAnimReaderContainer::CAnimTreeAnimReaderContainer(std::string_view name, std::shared_ptr reader, u32 dbIdx) -: CAnimTreeNode(name), x14_reader(reader), x1c_animDbIdx(dbIdx) {} +: CAnimTreeNode(name), x14_reader(std::move(reader)), x1c_animDbIdx(dbIdx) {} u32 CAnimTreeAnimReaderContainer::Depth() const { return 1; } From 3cec19437afd9f42fddc85c1389bb1f5fd3abbbf Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 9 Mar 2020 11:08:15 -0400 Subject: [PATCH 02/11] CAnimSysContext: std::move TToken instance in constructor Provides the same interface, but allows for calling code to move into the constructor. --- Runtime/Character/CAnimSysContext.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Runtime/Character/CAnimSysContext.hpp b/Runtime/Character/CAnimSysContext.hpp index e6a68e595..ca0986e1b 100644 --- a/Runtime/Character/CAnimSysContext.hpp +++ b/Runtime/Character/CAnimSysContext.hpp @@ -15,8 +15,8 @@ struct CAnimSysContext { std::shared_ptr x8_random; CSimplePool& xc_store; - CAnimSysContext(const TToken& transDB, u32 randomSeed, CSimplePool& store) - : x0_transDB(transDB), x8_random(std::make_shared(randomSeed)), xc_store(store) {} + CAnimSysContext(TToken transDB, u32 randomSeed, CSimplePool& store) + : x0_transDB(std::move(transDB)), x8_random(std::make_shared(randomSeed)), xc_store(store) {} }; } // namespace urde From 79565d7f52df0a1897521b1fb4e2564b03192491 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 9 Mar 2020 11:11:25 -0400 Subject: [PATCH 03/11] CAnimSourceInfo: std::move TSubAnimTypeToken instance in constructor Provides the same behavior, but allows calling code to move into the constructor. --- Runtime/Character/CAnimSourceReader.cpp | 2 +- Runtime/Character/CAnimSourceReader.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Runtime/Character/CAnimSourceReader.cpp b/Runtime/Character/CAnimSourceReader.cpp index f0722dc54..2362dfff2 100644 --- a/Runtime/Character/CAnimSourceReader.cpp +++ b/Runtime/Character/CAnimSourceReader.cpp @@ -8,7 +8,7 @@ namespace urde { -CAnimSourceInfo::CAnimSourceInfo(const TSubAnimTypeToken& token) : x4_token(token) {} +CAnimSourceInfo::CAnimSourceInfo(TSubAnimTypeToken token) : x4_token(std::move(token)) {} bool CAnimSourceInfo::HasPOIData() const { return x4_token->x58_evntData.HasReference(); } diff --git a/Runtime/Character/CAnimSourceReader.hpp b/Runtime/Character/CAnimSourceReader.hpp index bbbe67bc3..5b55e5fb7 100644 --- a/Runtime/Character/CAnimSourceReader.hpp +++ b/Runtime/Character/CAnimSourceReader.hpp @@ -28,7 +28,7 @@ class CAnimSourceInfo : public IAnimSourceInfo { TSubAnimTypeToken x4_token; public: - CAnimSourceInfo(const TSubAnimTypeToken& token); + explicit CAnimSourceInfo(TSubAnimTypeToken token); bool HasPOIData() const override; const std::vector& GetBoolPOIStream() const override; const std::vector& GetInt32POIStream() const override; From e289643742d388d78e8353432ed329509eda9ce2 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 9 Mar 2020 11:22:19 -0400 Subject: [PATCH 04/11] CAnimData: std::move constructor arguments where applicable Same behavior, but allows calling code to move into the respective parameters now. --- Runtime/Character/CAnimData.cpp | 27 +++++++++++++------------ Runtime/Character/CAnimData.hpp | 9 ++++----- Runtime/Character/CCharacterFactory.cpp | 9 +++++---- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/Runtime/Character/CAnimData.cpp b/Runtime/Character/CAnimData.cpp index 09adede33..c621ed647 100644 --- a/Runtime/Character/CAnimData.cpp +++ b/Runtime/Character/CAnimData.cpp @@ -40,19 +40,19 @@ void CAnimData::FreeCache() {} void CAnimData::InitializeCache() {} CAnimData::CAnimData(CAssetId id, const CCharacterInfo& character, int defaultAnim, int charIdx, bool loop, - const TLockedToken& layout, const TToken& model, + TLockedToken layout, TToken model, const std::optional>& iceModel, - const std::weak_ptr& ctx, const std::shared_ptr& animMgr, - const std::shared_ptr& transMgr, - const TLockedToken& charFactory, int drawInstCount) -: x0_charFactory(charFactory) + const std::weak_ptr& ctx, std::shared_ptr animMgr, + std::shared_ptr transMgr, TLockedToken charFactory, + int drawInstCount) +: x0_charFactory(std::move(charFactory)) , xc_charInfo(character) -, xcc_layoutData(layout) -, xd8_modelData(model) +, xcc_layoutData(std::move(layout)) +, xd8_modelData(std::move(model)) , xfc_animCtx(ctx.lock()) -, x100_animMgr(animMgr) +, x100_animMgr(std::move(animMgr)) , x1d8_selfId(id) -, x1fc_transMgr(transMgr) +, x1fc_transMgr(std::move(transMgr)) , x204_charIdx(charIdx) , x208_defaultAnim(defaultAnim) , x224_pose(layout->GetSegIdList().GetList().size()) @@ -82,10 +82,11 @@ CAnimData::CAnimData(CAssetId id, const CCharacterInfo& character, int defaultAn character.GetCharacterName()); } - std::shared_ptr treeNode = GetAnimationManager()->GetAnimationTree( - character.GetAnimationIndex(defaultAnim), CMetaAnimTreeBuildOrders::NoSpecialOrders()); - if (treeNode != x1f8_animRoot) - x1f8_animRoot = treeNode; + auto treeNode = GetAnimationManager()->GetAnimationTree(character.GetAnimationIndex(defaultAnim), + CMetaAnimTreeBuildOrders::NoSpecialOrders()); + if (treeNode != x1f8_animRoot) { + x1f8_animRoot = std::move(treeNode); + } } void CAnimData::SetParticleEffectState(std::string_view effectName, bool active, CStateManager& mgr) { diff --git a/Runtime/Character/CAnimData.hpp b/Runtime/Character/CAnimData.hpp index 7d0ce311b..d2cf6a91c 100644 --- a/Runtime/Character/CAnimData.hpp +++ b/Runtime/Character/CAnimData.hpp @@ -155,11 +155,10 @@ private: public: CAnimData(CAssetId, const CCharacterInfo& character, int defaultAnim, int charIdx, bool loop, - const TLockedToken& layout, const TToken& model, - const std::optional>& iceModel, - const std::weak_ptr& ctx, const std::shared_ptr& animMgr, - const std::shared_ptr& transMgr, const TLockedToken& charFactory, - int drawInstCount); + TLockedToken layout, TToken model, + const std::optional>& iceModel, const std::weak_ptr& ctx, + std::shared_ptr animMgr, std::shared_ptr transMgr, + TLockedToken charFactory, int drawInstCount); void SetParticleEffectState(std::string_view effectName, bool active, CStateManager& mgr); void InitializeEffects(CStateManager&, TAreaId, const zeus::CVector3f&); diff --git a/Runtime/Character/CCharacterFactory.cpp b/Runtime/Character/CCharacterFactory.cpp index d22efeae5..13088c44c 100644 --- a/Runtime/Character/CCharacterFactory.cpp +++ b/Runtime/Character/CCharacterFactory.cpp @@ -78,19 +78,20 @@ std::unique_ptr CCharacterFactory::CreateCharacter(int charIdx, bool const TLockedToken& factory, int defaultAnim, int drawInsts) const { const CCharacterInfo& charInfo = x4_charInfoDB[charIdx]; - CVParamTransfer charParm(new TObjOwnerParam(&charInfo)); + const CVParamTransfer charParm(new TObjOwnerParam(&charInfo)); TToken skinnedModel = const_cast(this)->x70_cacheResPool.GetObj( {FourCC(drawInsts << 16), charInfo.GetModelId()}, charParm); std::optional> iceModel; - if (charInfo.GetIceModelId().IsValid() && charInfo.GetIceSkinRulesId().IsValid()) + if (charInfo.GetIceModelId().IsValid() && charInfo.GetIceSkinRulesId().IsValid()) { iceModel.emplace(const_cast(this)->x70_cacheResPool.GetObj( {FourCC((drawInsts << 16) | 1), charInfo.GetIceModelId()}, charParm)); + } return std::make_unique(x68_selfId, charInfo, defaultAnim, charIdx, loop, x14_charLayoutInfoDB[charIdx], - skinnedModel, iceModel, x24_sysContext, x28_animMgr, x2c_transMgr, factory, - drawInsts); + std::move(skinnedModel), iceModel, x24_sysContext, x28_animMgr, x2c_transMgr, + factory, drawInsts); } CAssetId CCharacterFactory::GetEventResourceIdForAnimResourceId(CAssetId id) const { From ab17c1cf2f203a990bd219aa4c5a8ba1667646de Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 9 Mar 2020 11:27:34 -0400 Subject: [PATCH 05/11] CAnimationManager: std::move parameters to constructor where applicable Allows calling code to move into the respective arguments. --- Runtime/Character/CAnimationManager.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Runtime/Character/CAnimationManager.hpp b/Runtime/Character/CAnimationManager.hpp index cff8282e3..ef194d97b 100644 --- a/Runtime/Character/CAnimationManager.hpp +++ b/Runtime/Character/CAnimationManager.hpp @@ -19,8 +19,8 @@ class CAnimationManager { CAnimSysContext x8_sysCtx; public: - CAnimationManager(const TToken& animDB, const CAnimSysContext& sysCtx) - : x0_animDB(animDB), x8_sysCtx(sysCtx) {} + CAnimationManager(TToken animDB, CAnimSysContext sysCtx) + : x0_animDB(std::move(animDB)), x8_sysCtx(std::move(sysCtx)) {} const CAnimationDatabaseGame* GetAnimationDatabase() const; std::shared_ptr GetAnimationTree(s32, const CMetaAnimTreeBuildOrders& orders) const; From fa23d0bb9c23fec138a60eabee7c76cecbf9491c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 9 Mar 2020 11:31:51 -0400 Subject: [PATCH 06/11] CAnimTreeLoopIn: std::move constructor parameters where applicable Allows the constructor parameters to be moved into. --- Runtime/Character/CAnimTreeLoopIn.cpp | 8 ++++---- Runtime/Character/CAnimTreeLoopIn.hpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Runtime/Character/CAnimTreeLoopIn.cpp b/Runtime/Character/CAnimTreeLoopIn.cpp index 985bc6121..c8dff7e74 100644 --- a/Runtime/Character/CAnimTreeLoopIn.cpp +++ b/Runtime/Character/CAnimTreeLoopIn.cpp @@ -19,13 +19,13 @@ CAnimTreeLoopIn::CAnimTreeLoopIn(const std::weak_ptr& a, const st , x30_fundamentals(CSequenceHelper(x14_child, x18_nextAnim, animCtx).ComputeSequenceFundamentals()) {} CAnimTreeLoopIn::CAnimTreeLoopIn(const std::weak_ptr& a, const std::weak_ptr& b, - bool didLoopIn, const CAnimSysContext& animCtx, std::string_view name, - const CSequenceFundamentals& fundamentals, const CCharAnimTime& time) + bool didLoopIn, CAnimSysContext animCtx, std::string_view name, + CSequenceFundamentals fundamentals, const CCharAnimTime& time) : CAnimTreeSingleChild(a, name) , x18_nextAnim(b.lock()) , x1c_didLoopIn(didLoopIn) -, x20_animCtx(animCtx) -, x30_fundamentals(fundamentals) +, x20_animCtx(std::move(animCtx)) +, x30_fundamentals(std::move(fundamentals)) , x88_curTime(time) {} CAnimTreeEffectiveContribution CAnimTreeLoopIn::VGetContributionOfHighestInfluence() const { diff --git a/Runtime/Character/CAnimTreeLoopIn.hpp b/Runtime/Character/CAnimTreeLoopIn.hpp index 644e67e27..29dc6202e 100644 --- a/Runtime/Character/CAnimTreeLoopIn.hpp +++ b/Runtime/Character/CAnimTreeLoopIn.hpp @@ -23,7 +23,7 @@ public: CAnimTreeLoopIn(const std::weak_ptr& a, const std::weak_ptr& b, const std::weak_ptr& c, const CAnimSysContext& animCtx, std::string_view name); CAnimTreeLoopIn(const std::weak_ptr& a, const std::weak_ptr& b, bool didLoopIn, - const CAnimSysContext& animCtx, std::string_view name, const CSequenceFundamentals& fundamentals, + CAnimSysContext animCtx, std::string_view name, CSequenceFundamentals fundamentals, const CCharAnimTime& time); CAnimTreeEffectiveContribution VGetContributionOfHighestInfluence() const override; bool VSupportsReverseView() const { return false; } From 9fe671af99cdf368963cebf5a8cfd19a7350ed2a Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 9 Mar 2020 11:33:22 -0400 Subject: [PATCH 07/11] CAnimTreeSequence: std::move constructor parameters where applicable Allows the constructor arguments to be moved into the constructor. --- Runtime/Character/CAnimTreeSequence.cpp | 20 ++++++++++---------- Runtime/Character/CAnimTreeSequence.hpp | 9 ++++----- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Runtime/Character/CAnimTreeSequence.cpp b/Runtime/Character/CAnimTreeSequence.cpp index 628840687..0308eae34 100644 --- a/Runtime/Character/CAnimTreeSequence.cpp +++ b/Runtime/Character/CAnimTreeSequence.cpp @@ -6,22 +6,22 @@ namespace urde { -CAnimTreeSequence::CAnimTreeSequence(const std::vector>& seq, const CAnimSysContext& animSys, +CAnimTreeSequence::CAnimTreeSequence(std::vector> seq, CAnimSysContext animSys, std::string_view name) : CAnimTreeSingleChild(seq[0]->GetAnimationTree(animSys, CMetaAnimTreeBuildOrders::NoSpecialOrders()), name) -, x18_animCtx(animSys) -, x28_sequence(seq) -, x3c_fundamentals(CSequenceHelper(seq, animSys).ComputeSequenceFundamentals()) +, x18_animCtx(std::move(animSys)) +, x28_sequence(std::move(seq)) +, x3c_fundamentals(CSequenceHelper(x28_sequence, x18_animCtx).ComputeSequenceFundamentals()) , x94_curTime(0.f) {} CAnimTreeSequence::CAnimTreeSequence(const std::shared_ptr& curNode, - const std::vector>& metaAnims, - const CAnimSysContext& animSys, std::string_view name, - const CSequenceFundamentals& fundamentals, const CCharAnimTime& time) + std::vector> metaAnims, + CAnimSysContext animSys, std::string_view name, + CSequenceFundamentals fundamentals, const CCharAnimTime& time) : CAnimTreeSingleChild(curNode, name) -, x18_animCtx(animSys) -, x28_sequence(metaAnims) -, x3c_fundamentals(fundamentals) +, x18_animCtx(std::move(animSys)) +, x28_sequence(std::move(metaAnims)) +, x3c_fundamentals(std::move(fundamentals)) , x94_curTime(time) {} CAnimTreeEffectiveContribution CAnimTreeSequence::VGetContributionOfHighestInfluence() const { diff --git a/Runtime/Character/CAnimTreeSequence.hpp b/Runtime/Character/CAnimTreeSequence.hpp index b82d12470..82e796982 100644 --- a/Runtime/Character/CAnimTreeSequence.hpp +++ b/Runtime/Character/CAnimTreeSequence.hpp @@ -20,11 +20,10 @@ class CAnimTreeSequence : public CAnimTreeSingleChild { CCharAnimTime x94_curTime; public: - CAnimTreeSequence(const std::vector>& seq, const CAnimSysContext& animSys, - std::string_view name); - CAnimTreeSequence(const std::shared_ptr& curNode, - const std::vector>& metaAnims, const CAnimSysContext& animSys, - std::string_view name, const CSequenceFundamentals& fundamentals, const CCharAnimTime& time); + CAnimTreeSequence(std::vector> seq, CAnimSysContext animSys, std::string_view name); + CAnimTreeSequence(const std::shared_ptr& curNode, std::vector> metaAnims, + CAnimSysContext animSys, std::string_view name, CSequenceFundamentals fundamentals, + const CCharAnimTime& time); CAnimTreeEffectiveContribution VGetContributionOfHighestInfluence() const override; std::shared_ptr VGetBestUnblendedChild() const override; From cff12f0986145c2c62eef05bf0ae0c8fcb7e8c45 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 9 Mar 2020 11:41:30 -0400 Subject: [PATCH 08/11] TAnimSourceInfo: std::move constructor parameter where applicable Allows calling code to move into the constructor. --- Runtime/Character/CFBStreamedAnimReader.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Runtime/Character/CFBStreamedAnimReader.hpp b/Runtime/Character/CFBStreamedAnimReader.hpp index e58a91c8a..15af8800d 100644 --- a/Runtime/Character/CFBStreamedAnimReader.hpp +++ b/Runtime/Character/CFBStreamedAnimReader.hpp @@ -14,7 +14,7 @@ class TAnimSourceInfo : public IAnimSourceInfo { TSubAnimTypeToken x4_token; public: - TAnimSourceInfo(const TSubAnimTypeToken& token) : x4_token(token) {} + explicit TAnimSourceInfo(TSubAnimTypeToken token) : x4_token(std::move(token)) {} bool HasPOIData() const override { return x4_token->HasPOIData(); } const std::vector& GetBoolPOIStream() const override { return x4_token->GetBoolPOIStream(); } const std::vector& GetInt32POIStream() const override { return x4_token->GetInt32POIStream(); } From 815f492e0fce7fc8ba4853a457104e6d387765f9 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 9 Mar 2020 11:45:53 -0400 Subject: [PATCH 09/11] CSequenceHelper: std::move constructor parameters where applicable Same behavior, but allows for calling code to move into the interface. --- Runtime/Character/CSequenceHelper.cpp | 27 +++++++++++++-------------- Runtime/Character/CSequenceHelper.hpp | 11 +++++------ 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/Runtime/Character/CSequenceHelper.cpp b/Runtime/Character/CSequenceHelper.cpp index aff24ab97..71325fa09 100644 --- a/Runtime/Character/CSequenceHelper.cpp +++ b/Runtime/Character/CSequenceHelper.cpp @@ -10,30 +10,29 @@ namespace urde { -CSequenceFundamentals::CSequenceFundamentals(const CSteadyStateAnimInfo& ssInfo, - const std::vector& boolNodes, - const std::vector& int32Nodes, - const std::vector& particleNodes, - const std::vector& soundNodes) +CSequenceFundamentals::CSequenceFundamentals(const CSteadyStateAnimInfo& ssInfo, std::vector boolNodes, + std::vector int32Nodes, + std::vector particleNodes, + std::vector soundNodes) : x0_ssInfo(ssInfo) -, x18_boolNodes(boolNodes) -, x28_int32Nodes(int32Nodes) -, x38_particleNodes(particleNodes) -, x48_soundNodes(soundNodes) {} +, x18_boolNodes(std::move(boolNodes)) +, x28_int32Nodes(std::move(int32Nodes)) +, x38_particleNodes(std::move(particleNodes)) +, x48_soundNodes(std::move(soundNodes)) {} CSequenceHelper::CSequenceHelper(const std::shared_ptr& a, const std::shared_ptr& b, - const CAnimSysContext& animCtx) -: x0_animCtx(animCtx) { + CAnimSysContext animCtx) +: x0_animCtx(std::move(animCtx)) { x10_treeNodes.reserve(2); x10_treeNodes.push_back(a); x10_treeNodes.push_back(b); } -CSequenceHelper::CSequenceHelper(const std::vector>& nodes, const CAnimSysContext& animCtx) -: x0_animCtx(animCtx) { +CSequenceHelper::CSequenceHelper(const std::vector>& nodes, CAnimSysContext animCtx) +: x0_animCtx(std::move(animCtx)) { x10_treeNodes.reserve(nodes.size()); for (const std::shared_ptr& meta : nodes) - x10_treeNodes.push_back(meta->GetAnimationTree(animCtx, CMetaAnimTreeBuildOrders::NoSpecialOrders())); + x10_treeNodes.push_back(meta->GetAnimationTree(x0_animCtx, CMetaAnimTreeBuildOrders::NoSpecialOrders())); } CSequenceFundamentals CSequenceHelper::ComputeSequenceFundamentals() { diff --git a/Runtime/Character/CSequenceHelper.hpp b/Runtime/Character/CSequenceHelper.hpp index c93d13172..331974369 100644 --- a/Runtime/Character/CSequenceHelper.hpp +++ b/Runtime/Character/CSequenceHelper.hpp @@ -22,10 +22,9 @@ class CSequenceFundamentals { std::vector x48_soundNodes; public: - CSequenceFundamentals(const CSteadyStateAnimInfo& ssInfo, const std::vector& boolNodes, - const std::vector& int32Nodes, - const std::vector& particleNodes, - const std::vector& soundNodes); + CSequenceFundamentals(const CSteadyStateAnimInfo& ssInfo, std::vector boolNodes, + std::vector int32Nodes, std::vector particleNodes, + std::vector soundNodes); const CSteadyStateAnimInfo& GetSteadyStateAnimInfo() const { return x0_ssInfo; } const std::vector& GetBoolPointsOfInterest() const { return x18_boolNodes; } @@ -41,8 +40,8 @@ class CSequenceHelper { public: CSequenceHelper(const std::shared_ptr& a, const std::shared_ptr& b, - const CAnimSysContext& animCtx); - CSequenceHelper(const std::vector>& nodes, const CAnimSysContext& animCtx); + CAnimSysContext animCtx); + CSequenceHelper(const std::vector>& nodes, CAnimSysContext animCtx); CSequenceFundamentals ComputeSequenceFundamentals(); }; From 3a96c574b2e9d6abe168e969b0480f08ee55bdb8 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 9 Mar 2020 11:48:14 -0400 Subject: [PATCH 10/11] CTransitionDatabaseGame: std::move constructor parameters where applicable Same behavior, but allows the parameters to be moved into from calling code. --- Runtime/Character/CTransitionDatabaseGame.cpp | 4 ++-- Runtime/Character/CTransitionDatabaseGame.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Runtime/Character/CTransitionDatabaseGame.cpp b/Runtime/Character/CTransitionDatabaseGame.cpp index 4f7f9b0e7..c29369ce4 100644 --- a/Runtime/Character/CTransitionDatabaseGame.cpp +++ b/Runtime/Character/CTransitionDatabaseGame.cpp @@ -11,8 +11,8 @@ namespace urde { CTransitionDatabaseGame::CTransitionDatabaseGame(const std::vector& transitions, const std::vector& halfTransitions, - const std::shared_ptr& defaultTrans) -: x10_defaultTrans(defaultTrans) { + std::shared_ptr defaultTrans) +: x10_defaultTrans(std::move(defaultTrans)) { x14_transitions.reserve(transitions.size()); for (const CTransition& trans : transitions) x14_transitions.emplace_back(trans.GetAnimPair(), trans.GetMetaTrans()); diff --git a/Runtime/Character/CTransitionDatabaseGame.hpp b/Runtime/Character/CTransitionDatabaseGame.hpp index 45f51c17e..d464cd6b6 100644 --- a/Runtime/Character/CTransitionDatabaseGame.hpp +++ b/Runtime/Character/CTransitionDatabaseGame.hpp @@ -18,7 +18,7 @@ class CTransitionDatabaseGame final : public CTransitionDatabase { public: CTransitionDatabaseGame(const std::vector& transitions, const std::vector& halfTransitions, - const std::shared_ptr& defaultTrans); + std::shared_ptr defaultTrans); const std::shared_ptr& GetMetaTrans(u32, u32) const override; }; From 39b561b0895e509cc431298590c109addbc57ddb Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 9 Mar 2020 11:51:06 -0400 Subject: [PATCH 11/11] CTransitionManager: std::move constructor parameters where applicable Allows calling code to move into the constructor --- Runtime/Character/CTransitionManager.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Runtime/Character/CTransitionManager.hpp b/Runtime/Character/CTransitionManager.hpp index 8d72a5052..4ba58a2e0 100644 --- a/Runtime/Character/CTransitionManager.hpp +++ b/Runtime/Character/CTransitionManager.hpp @@ -15,7 +15,7 @@ class CTransitionManager { CAnimSysContext x0_animCtx; public: - CTransitionManager(const CAnimSysContext& sysCtx) : x0_animCtx(sysCtx) {} + explicit CTransitionManager(CAnimSysContext sysCtx) : x0_animCtx(std::move(sysCtx)) {} std::shared_ptr GetTransitionTree(const std::shared_ptr& a, const std::shared_ptr& b) const; };