CActorModelParticles: Make DGRP array constexpr

Technically this array wasn't readonly and contained a sequence of
modifiable elements. We can make this constexpr so that the compiler can
definitively place it into the read-only segment.
This commit is contained in:
Lioncash 2019-09-09 20:44:21 -04:00
parent f07fc458d2
commit 5baf3206f4
1 changed files with 7 additions and 3 deletions

View File

@ -1,4 +1,7 @@
#include "CActorModelParticles.hpp"
#include <array>
#include "CStateManager.hpp"
#include "GameGlobalObjects.hpp"
#include "CSimplePool.hpp"
@ -377,7 +380,7 @@ void CActorModelParticles::IncrementDependency(EDependency d) {
xe4_loadingDeps |= (1 << int(d));
}
static const char* ParticleDGRPs[] = {
constexpr std::array<const char*, 6> ParticleDGRPs{
"Effect_OnFire_DGRP", "Effect_IceBreak_DGRP", "Effect_Ash_DGRP",
"Effect_FirePop_DGRP", "Effect_Electric_DGRP", "Effect_IcePop_DGRP",
};
@ -393,8 +396,9 @@ CActorModelParticles::Dependency CActorModelParticles::GetParticleDGRPTokens(con
}
void CActorModelParticles::LoadParticleDGRPs() {
for (int i = 0; i < 6; ++i)
x50_dgrps.push_back(GetParticleDGRPTokens(ParticleDGRPs[i]));
for (const char* dgrp : ParticleDGRPs) {
x50_dgrps.push_back(GetParticleDGRPTokens(dgrp));
}
}
std::unique_ptr<CElementGen> CActorModelParticles::MakeOnFireGen() const {