Particle entities should avoid resetting simulation when setMaxParticles is called.

This caused all particles to disappear when a network packet was received.
This commit is contained in:
Anthony Thibault 2015-05-25 12:22:38 -07:00
parent 225021671a
commit 18d683bced

View file

@ -490,6 +490,7 @@ void ParticleEffectEntityItem::stepSimulation(float deltaTime) {
} }
void ParticleEffectEntityItem::setMaxParticles(quint32 maxParticles) { void ParticleEffectEntityItem::setMaxParticles(quint32 maxParticles) {
if (_maxParticles != maxParticles) {
_maxParticles = maxParticles; _maxParticles = maxParticles;
// TODO: try to do something smart here and preserve the state of existing particles. // TODO: try to do something smart here and preserve the state of existing particles.
@ -503,6 +504,7 @@ void ParticleEffectEntityItem::setMaxParticles(quint32 maxParticles) {
_particleHeadIndex = 0; _particleHeadIndex = 0;
_particleTailIndex = 0; _particleTailIndex = 0;
_timeUntilNextEmit = 0.0f; _timeUntilNextEmit = 0.0f;
}
} }
// because particles are in a ring buffer, this isn't trivial // because particles are in a ring buffer, this isn't trivial