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

View File

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