Fix CElementGen::x60_advValues crash

This commit is contained in:
Phillip Stephens 2021-05-31 13:46:25 -07:00
parent 41a2a4ae6d
commit 13350ca3d9
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
1 changed files with 4 additions and 4 deletions

View File

@ -358,8 +358,8 @@ void CElementGen::AccumulateBounds(const zeus::CVector3f& pos, float size) {
void CElementGen::UpdateAdvanceAccessParameters(u32 activeParticleCount, s32 particleFrame) {
CGenDescription* desc = x28_loadedGenDesc;
if (activeParticleCount > x60_advValues.size()) {
Log.report(logvisor::Fatal, FMT_STRING("activeParticleCount ({}) > advValues size ({})"),
if (activeParticleCount >= x60_advValues.size()) {
Log.report(logvisor::Fatal, FMT_STRING("activeParticleCount ({}) >= advValues size ({})"),
activeParticleCount, x60_advValues.size());
}
@ -512,8 +512,8 @@ void CElementGen::CreateNewParticles(int count) {
CGlobalRandom gr(x27c_randState);
x30_particles.reserve(count + x90_MAXP);
if (x26d_28_enableADV && x60_advValues.capacity() < count + x30_particles.size()) {
x60_advValues.resize(std::min(int(x60_advValues.capacity() * 2), x90_MAXP));
if (x26d_28_enableADV && x60_advValues.size() < count + x30_particles.size()) {
x60_advValues.resize(std::min(int(x60_advValues.size() * 2), x90_MAXP));
}
CParticleGlobals::instance()->m_particleAccessParameters = nullptr;