Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 11, 2005, 2:23:54 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/heightMap: merged trunk back to the heightMap branche
merged with command:
svn merge trunk/ branches/heightMap/ -r 4122:HEAD

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/heightMap/src/lib/graphics/particles/particle_system.cc

    r4122 r4165  
    4040   this->particleType = type;
    4141   this->particles = NULL;
     42   this->deadList = NULL;
    4243   this->setConserve(.8);
    4344   this->setLifeSpan(.1);
     
    5758  // delete what has to be deleted here
    5859   ParticleEngine::getInstance()->removeSystem(this);
     60
     61   // deleting all the living Particles
     62   while (this->particles)
     63     {
     64       Particle* tmpDelPart = this->particles;
     65       this->particles = this->particles->next;
     66       delete tmpDelPart;
     67     }
     68
     69   // deleting all the dead particles
     70   while (this->deadList)
     71     {
     72       Particle* tmpDelPart = this->deadList;
     73       this->deadList = this->deadList->next;
     74       delete tmpDelPart;
     75     }
    5976}
    6077
     
    199216            {
    200217              prevPart->next = tickPart->next;
    201               delete tickPart;
     218              tickPart->next = this->deadList;
     219              this->deadList = tickPart;
    202220              tickPart = prevPart->next;
    203221            }
     
    206224              prevPart = NULL;
    207225              this->particles = tickPart->next;
    208               delete tickPart;
     226              tickPart->next = this->deadList;
     227              this->deadList = tickPart;
    209228              tickPart = this->particles;
    210229            }
     
    266285      if (unlikely(particles == NULL))
    267286        {
    268           this->particles = new Particle;
     287          if (likely(deadList != NULL))
     288            {
     289              this->particles = this->deadList;
     290              deadList = deadList->next;
     291            }
     292          else
     293            this->particles = new Particle;
    269294          this->particles->next = NULL;
    270295        }
     
    272297      else
    273298        {
    274           Particle* tmpPart = new Particle;
     299          Particle* tmpPart;
     300          if (likely(deadList != NULL))
     301            {
     302              tmpPart = this->deadList;
     303              deadList = deadList->next;
     304            }
     305          else
     306            tmpPart = new Particle;
    275307          tmpPart->next = this->particles;
    276308          this->particles = tmpPart;
     
    300332  PRINT(0)("  ParticleSystem %s\n", this->name);
    301333  PRINT(0)("  ParticleCount: %d, maximumCount: %d :: filled %d%%\n", this->count, this->maxCount, 100*this->count/this->maxCount);
    302 }
     334  if (deadList)
     335    {
     336      PRINT(0)("  - ParticleDeadList is used: ");
     337      int i = 1;
     338      Particle* tmpPart = this->deadList;
     339      while (tmpPart = tmpPart->next) ++i;
     340      PRINT(0)("count: %d\n", i);
     341    }
     342}
Note: See TracChangeset for help on using the changeset viewer.