From b2ec3e7eac58b5d945a1ed17fd43edc679e47f8d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 12 Apr 2020 11:36:17 -0400 Subject: [PATCH] CGameArea: Make use of std::array where applicable Same behavior, stronger typing, and optional runtime checking in debug mode. --- Runtime/World/CGameArea.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Runtime/World/CGameArea.cpp b/Runtime/World/CGameArea.cpp index 28c5f04d2..4c8bbe12e 100644 --- a/Runtime/World/CGameArea.cpp +++ b/Runtime/World/CGameArea.cpp @@ -1,5 +1,7 @@ #include "Runtime/World/CGameArea.hpp" +#include + #include "Runtime/CGameState.hpp" #include "Runtime/CSimplePool.hpp" #include "Runtime/CStateManager.hpp" @@ -43,8 +45,10 @@ CAreaRenderOctTree::CAreaRenderOctTree(const u8* buf) : x0_buf(buf) { } } -static const u32 ChildCounts[] = {0, 2, 2, 4, 2, 4, 4, 8}; -u32 CAreaRenderOctTree::Node::GetChildCount() const { return ChildCounts[x2_flags]; } +u32 CAreaRenderOctTree::Node::GetChildCount() const { + static constexpr std::array ChildCounts{0, 2, 2, 4, 2, 4, 4, 8}; + return ChildCounts[x2_flags]; +} zeus::CAABox CAreaRenderOctTree::Node::GetNodeBounds(const zeus::CAABox& curAABB, int idx) const { zeus::CVector3f center = curAABB.center();