From cc6d50a1aa3810be76b24bc40c146ddc126d129d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 16 Mar 2020 16:05:50 -0400 Subject: [PATCH 1/2] CPoseAsTransforms: Mark constructor as explicit Prevents potentially error-prone implicit constructions. --- Runtime/Character/CPoseAsTransforms.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Runtime/Character/CPoseAsTransforms.hpp b/Runtime/Character/CPoseAsTransforms.hpp index a07d30553..e5dd4c63c 100644 --- a/Runtime/Character/CPoseAsTransforms.hpp +++ b/Runtime/Character/CPoseAsTransforms.hpp @@ -29,7 +29,7 @@ private: CSegId xd4_lastInserted = 0; public: - CPoseAsTransforms(u8 boneCount); + explicit CPoseAsTransforms(u8 boneCount); bool ContainsDataFor(const CSegId& id) const; void Clear(); void AccumulateScaledTransform(const CSegId& id, zeus::CMatrix3f& rotation, float scale) const; From f45e2362c5035831308324d153cd73ad99de0466 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 16 Mar 2020 16:07:04 -0400 Subject: [PATCH 2/2] CPoseAsTransforms: Make use of std::array where applicable --- Runtime/Character/CPoseAsTransforms.cpp | 3 +-- Runtime/Character/CPoseAsTransforms.hpp | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Runtime/Character/CPoseAsTransforms.cpp b/Runtime/Character/CPoseAsTransforms.cpp index 8b617a250..8c7b91d57 100644 --- a/Runtime/Character/CPoseAsTransforms.cpp +++ b/Runtime/Character/CPoseAsTransforms.cpp @@ -12,8 +12,7 @@ bool CPoseAsTransforms::ContainsDataFor(const CSegId& id) const { } void CPoseAsTransforms::Clear() { - for (u32 i = 0; i < 100; ++i) - x8_links[i] = std::make_pair(CSegId(), CSegId()); + x8_links.fill({}); xd4_lastInserted = 0; x0_nextId = 0; } diff --git a/Runtime/Character/CPoseAsTransforms.hpp b/Runtime/Character/CPoseAsTransforms.hpp index e5dd4c63c..1c2087fc9 100644 --- a/Runtime/Character/CPoseAsTransforms.hpp +++ b/Runtime/Character/CPoseAsTransforms.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include @@ -24,7 +25,7 @@ public: private: CSegId x0_nextId = 0; CSegId x1_count; - std::pair x8_links[100]; + std::array, 100> x8_links; std::unique_ptr xd0_transformArr; CSegId xd4_lastInserted = 0;