From 7ff3d297944879bc4d20f635055d6288a6395131 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 30 Mar 2020 05:44:10 -0400 Subject: [PATCH] CWallCrawlerSwarm: Mark static const data as constexpr Same behavior, but allows elision of initializers. While we're at it, we can convert an array over to std::array. --- Runtime/World/CWallCrawlerSwarm.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Runtime/World/CWallCrawlerSwarm.cpp b/Runtime/World/CWallCrawlerSwarm.cpp index 5063552a0..d78a9bcf3 100644 --- a/Runtime/World/CWallCrawlerSwarm.cpp +++ b/Runtime/World/CWallCrawlerSwarm.cpp @@ -1,5 +1,7 @@ #include "Runtime/World/CWallCrawlerSwarm.hpp" +#include + #include "Runtime/CSimplePool.hpp" #include "Runtime/CStateManager.hpp" #include "Runtime/GameGlobalObjects.hpp" @@ -598,14 +600,14 @@ void CWallCrawlerSwarm::LaunchBoid(CBoid& boid, const zeus::CVector3f& dir) { CSfxManager::AddEmitter(x55c_launchSfx, pos, zeus::skZero3f, true, false, 0x7f, x4_areaId); } -static const int kParticleCounts[] = {8, 2, 0, 0}; - void CWallCrawlerSwarm::AddParticle(const zeus::CTransform& xf) { - int i = 0; + static constexpr std::array particleCounts{8, 2, 0, 0}; + + size_t i = 0; for (auto& p : x524_particleGens) { p->SetParticleEmission(true); p->SetTranslation(xf.origin); - p->ForceParticleCreation(kParticleCounts[i]); + p->ForceParticleCreation(particleCounts[i]); p->SetParticleEmission(false); ++i; } @@ -863,7 +865,7 @@ void CWallCrawlerSwarm::Think(float dt, CStateManager& mgr) { if (x558_flavor == EFlavor::Parasite && x554_maxLaunches > 0) { zeus::CVector3f _383c = mgr.GetPlayer().GetTranslation() + zeus::skUp; - static const CMaterialFilter filter = CMaterialFilter::MakeInclude(EMaterialTypes::Solid); + static constexpr auto filter = CMaterialFilter::MakeInclude(EMaterialTypes::Solid); int numLaunched = 0; for (auto& b : x108_boids) { if (b.GetActive() && b.x80_26_launched)