- 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

@@ -40,12 +40,6 @@ class Model;
// class Particle
// =====================================================
enum State{
sPause, // No updates
sPlay,
sFade // No new particles
};
class Particle {
public:
//attributes
@@ -72,8 +66,6 @@ public:
int getEnergy() const {return energy;}
};
class ParticleSystem;
// =====================================================
// class ParticleObserver
// =====================================================
@@ -88,14 +80,20 @@ public:
// class ParticleSystem
// =====================================================
class ParticleSystem{
public:
enum BlendMode{
bmOne,
bmOneMinusAlpha
};
class ParticleSystem {
protected:
public:
enum State{
sPause, // No updates
sPlay,
sFade // No new particles
};
enum BlendMode{
bmOne,
bmOneMinusAlpha
};
protected:

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;
}
}
}
}