CMapWorld: Make use of std::array where applicable

Same behavior, stronger typing.
This commit is contained in:
Lioncash 2020-03-31 06:18:55 -04:00
parent 92833b185a
commit 12e42ba58a
1 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,7 @@
#include "Runtime/AutoMapper/CMapWorld.hpp" #include "Runtime/AutoMapper/CMapWorld.hpp"
#include <algorithm> #include <algorithm>
#include <array>
#include "Runtime/CSimplePool.hpp" #include "Runtime/CSimplePool.hpp"
#include "Runtime/CStateManager.hpp" #include "Runtime/CStateManager.hpp"
@ -12,7 +13,7 @@ namespace urde {
namespace { namespace {
struct Support { struct Support {
int x0_; int x0_;
int x4_[3]; std::array<int, 3> x4_;
}; };
struct Circle2 { struct Circle2 {
@ -65,7 +66,7 @@ Circle2 UpdateSupport1(int idx, const zeus::CVector2f** list, Support& support)
} }
Circle2 UpdateSupport2(int idx, const zeus::CVector2f** list, Support& support) { Circle2 UpdateSupport2(int idx, const zeus::CVector2f** list, Support& support) {
Circle2 circs[3] = {}; std::array<Circle2, 3> circs{};
float intersect; float intersect;
int circIdx = -1; int circIdx = -1;
float minRad = FLT_MAX; float minRad = FLT_MAX;
@ -94,7 +95,7 @@ Circle2 UpdateSupport2(int idx, const zeus::CVector2f** list, Support& support)
} }
Circle2 UpdateSupport3(int idx, const zeus::CVector2f** list, Support& support) { Circle2 UpdateSupport3(int idx, const zeus::CVector2f** list, Support& support) {
Circle2 circs[6] = {}; std::array<Circle2, 6> circs{};
float intersect; float intersect;
int circIdxA = -1; int circIdxA = -1;
int circIdxB = -1; int circIdxB = -1;
@ -212,7 +213,7 @@ Circle2 UpdateSupport3(int idx, const zeus::CVector2f** list, Support& support)
} }
using FSupport = Circle2 (*)(int idx, const zeus::CVector2f** list, Support& support); using FSupport = Circle2 (*)(int idx, const zeus::CVector2f** list, Support& support);
constexpr FSupport SupportFuncs[] = { constexpr std::array<FSupport, 4> SupportFuncs{
nullptr, nullptr,
UpdateSupport1, UpdateSupport1,
UpdateSupport2, UpdateSupport2,