mirror of https://github.com/AxioDL/metaforce.git
CActorModelParticles: Make GetParticleDGRPTokens take a std::string_view
Same behavior, but provides a more type-safe interface. All internal functions called within the function operate on std::string_view anyways.
This commit is contained in:
parent
75aa359855
commit
ad30f0c61c
|
@ -381,23 +381,24 @@ void CActorModelParticles::IncrementDependency(EDependency d) {
|
||||||
xe4_loadingDeps |= (1 << int(d));
|
xe4_loadingDeps |= (1 << int(d));
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr std::array<const char*, 6> ParticleDGRPs{
|
CActorModelParticles::Dependency CActorModelParticles::GetParticleDGRPTokens(std::string_view name) const {
|
||||||
"Effect_OnFire_DGRP", "Effect_IceBreak_DGRP", "Effect_Ash_DGRP",
|
|
||||||
"Effect_FirePop_DGRP", "Effect_Electric_DGRP", "Effect_IcePop_DGRP",
|
|
||||||
};
|
|
||||||
|
|
||||||
CActorModelParticles::Dependency CActorModelParticles::GetParticleDGRPTokens(const char* name) {
|
|
||||||
Dependency ret = {};
|
Dependency ret = {};
|
||||||
TToken<CDependencyGroup> dgrp = g_SimplePool->GetObj(name);
|
TToken<CDependencyGroup> dgrp = g_SimplePool->GetObj(name);
|
||||||
const auto& vector = dgrp->GetObjectTagVector();
|
const auto& vector = dgrp->GetObjectTagVector();
|
||||||
ret.x0_tokens.reserve(vector.size());
|
ret.x0_tokens.reserve(vector.size());
|
||||||
for (const SObjectTag& tag : vector)
|
for (const SObjectTag& tag : vector) {
|
||||||
ret.x0_tokens.push_back(g_SimplePool->GetObj(tag));
|
ret.x0_tokens.push_back(g_SimplePool->GetObj(tag));
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CActorModelParticles::LoadParticleDGRPs() {
|
void CActorModelParticles::LoadParticleDGRPs() {
|
||||||
for (const char* dgrp : ParticleDGRPs) {
|
static constexpr std::array particleDGRPs{
|
||||||
|
"Effect_OnFire_DGRP"sv, "Effect_IceBreak_DGRP"sv, "Effect_Ash_DGRP"sv,
|
||||||
|
"Effect_FirePop_DGRP"sv, "Effect_Electric_DGRP"sv, "Effect_IcePop_DGRP"sv,
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const auto& dgrp : particleDGRPs) {
|
||||||
x50_dgrps.push_back(GetParticleDGRPTokens(dgrp));
|
x50_dgrps.push_back(GetParticleDGRPTokens(dgrp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <string_view>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -137,7 +138,7 @@ private:
|
||||||
u8 xe5_justLoadedDeps = 0;
|
u8 xe5_justLoadedDeps = 0;
|
||||||
u8 xe6_loadedDeps = 0;
|
u8 xe6_loadedDeps = 0;
|
||||||
|
|
||||||
Dependency GetParticleDGRPTokens(const char* name);
|
Dependency GetParticleDGRPTokens(std::string_view name) const;
|
||||||
void LoadParticleDGRPs();
|
void LoadParticleDGRPs();
|
||||||
|
|
||||||
std::unique_ptr<CElementGen> MakeOnFireGen() const;
|
std::unique_ptr<CElementGen> MakeOnFireGen() const;
|
||||||
|
@ -158,6 +159,7 @@ public:
|
||||||
void AddStragglersToRenderer(const CStateManager& mgr);
|
void AddStragglersToRenderer(const CStateManager& mgr);
|
||||||
void Update(float dt, CStateManager& mgr);
|
void Update(float dt, CStateManager& mgr);
|
||||||
void SetupHook(TUniqueId uid);
|
void SetupHook(TUniqueId uid);
|
||||||
|
std::list<CItem>::iterator FindSystem(TUniqueId uid);
|
||||||
std::list<CItem>::const_iterator FindSystem(TUniqueId uid) const;
|
std::list<CItem>::const_iterator FindSystem(TUniqueId uid) const;
|
||||||
std::list<CItem>::iterator FindOrCreateSystem(CActor& act);
|
std::list<CItem>::iterator FindOrCreateSystem(CActor& act);
|
||||||
void StartIce(CActor& actor);
|
void StartIce(CActor& actor);
|
||||||
|
|
Loading…
Reference in New Issue