More accurate elementCount

This commit is contained in:
Simon Robertshaw 2012-12-14 23:01:54 +00:00
parent ceee0b6dc5
commit a1af662b8f
2 changed files with 6 additions and 3 deletions

View File

@ -1951,6 +1951,7 @@ void Simulation::clear_sim(void)
memset(portalp, 0, sizeof(portalp));
memset(fighters, 0, sizeof(fighters));
std::fill(elementCount, elementCount+PT_NUM, 0);
elementRecount = true;
fighcount = 0;
player.spwn = 0;
player2.spwn = 0;
@ -3550,7 +3551,7 @@ void Simulation::update_particles_i(int start, int inc)
ISWIRE--;
}
bool elementRecount = !(currentTick%180);
elementRecount |= !(currentTick%180);
if(elementRecount)
{
std::fill(elementCount, elementCount+PT_NUM, 0);
@ -3566,7 +3567,7 @@ void Simulation::update_particles_i(int start, int inc)
continue;
}
if(elementRecount)
elementCount[t]++;
elem_properties = elements[t].Properties;
@ -4768,6 +4769,7 @@ Simulation::Simulation():
currentTick = 0;
std::fill(elementCount, elementCount+PT_NUM, 0);
elementRecount = true;
//Create and attach gravity simulation
grav = new Gravity();

View File

@ -74,6 +74,7 @@ public:
int parts_lastActiveIndex;// = NPART-1;
int pfree;
int NUM_PARTS;
bool elementRecount;
int elementCount[PT_NUM];
int ISWIRE;
int force_stacking_check;