- bugfixes for stack overflow issue (static array size too large causing chkstk errors)

This commit is contained in:
Mark Vejvoda
2010-08-26 19:01:44 +00:00
parent d2f4b49f27
commit f3278c3cf3
13 changed files with 46 additions and 42 deletions

View File

@@ -93,7 +93,7 @@ void ParticleSystem::update() {
}
}
if(state != sFade){
if(state != ParticleSystem::sFade){
for(int i = 0; i < emissionRate; ++i){
Particle *p = createParticle();
initParticle(p, i);
@@ -920,20 +920,23 @@ void ParticleManager::update(int renderFps) {
int particleSystemCount = particleSystems.size();
int particleCount = 0;
list<ParticleSystem*>::iterator it;
for (it=particleSystems.begin(); it!=particleSystems.end(); it++) {
particleCount += (*it)->getAliveParticleCount();
list<ParticleSystem *>::iterator it;
for (it = particleSystems.begin(); it != particleSystems.end(); it++) {
ParticleSystem *ps = *it;
if(ps != NULL) {
particleCount += ps->getAliveParticleCount();
bool showParticle = true;
if( dynamic_cast<UnitParticleSystem *>((*it)) != NULL ||
dynamic_cast<FireParticleSystem *>((*it)) != NULL ) {
showParticle = (*it)->getVisible() || ((*it)->getState() == sFade);
}
if(showParticle == true) {
(*it)->update();
if((*it)->isEmpty()) {
delete *it;
*it= NULL;
bool showParticle = true;
if( dynamic_cast<UnitParticleSystem *>(ps) != NULL ||
dynamic_cast<FireParticleSystem *>(ps) != NULL ) {
showParticle = ps->getVisible() || (ps->getState() == ParticleSystem::sFade);
}
if(showParticle == true) {
ps->update();
if(ps->isEmpty()) {
delete ps;
*it= NULL;
}
}
}
}