This commit is contained in:
jacob1 2013-03-03 19:07:15 -05:00
parent 8b83ae9f95
commit f951e5cda9
3 changed files with 28 additions and 30 deletions

View File

@ -3549,9 +3549,7 @@ void Simulation::update_particles_i(int start, int inc)
} }
else else
{ {
//for ( golnum=1; golnum<=NGOL; golnum++) //This shouldn't be necessary any more. if (parts[r>>8].type==PT_LIFE)
//{
if (parts[r>>8].type==PT_LIFE/* && parts[r>>8].ctype==golnum-1*/)
{ {
golnum = parts[r>>8].ctype+1; golnum = parts[r>>8].ctype+1;
if (golnum<=0 || golnum>NGOLALT) { if (golnum<=0 || golnum>NGOLALT) {
@ -3574,11 +3572,8 @@ void Simulation::update_particles_i(int start, int inc)
} }
} else { } else {
parts[r>>8].tmp --; parts[r>>8].tmp --;
if (parts[r>>8].tmp<=0)
kill_part(r>>8);
} }
} }
//}
} }
} }
} }
@ -3603,8 +3598,6 @@ void Simulation::update_particles_i(int start, int inc)
if (parts[r>>8].tmp==grule[golnum][9]-1) if (parts[r>>8].tmp==grule[golnum][9]-1)
parts[r>>8].tmp --; parts[r>>8].tmp --;
} }
if (r && parts[r>>8].tmp<=0)
kill_part(r>>8);
} }
for ( z = 0; z<=NGOL; z++) for ( z = 0; z<=NGOL; z++)
gol2[ny][nx][z] = 0;//this improves performance A LOT compared to the memset, i was getting ~23 more fps with this. gol2[ny][nx][z] = 0;//this improves performance A LOT compared to the memset, i was getting ~23 more fps with this.

View File

@ -46,7 +46,7 @@ Element_LIFE::Element_LIFE()
HighTemperature = ITH; HighTemperature = ITH;
HighTemperatureTransition = NT; HighTemperatureTransition = NT;
Update = NULL; Update = &Element_LIFE::update;
Graphics = &Element_LIFE::graphics; Graphics = &Element_LIFE::graphics;
if(!Element_GOL_colourInit) if(!Element_GOL_colourInit)
@ -64,6 +64,13 @@ Element_LIFE::Element_LIFE()
} }
} }
//#TPT-Directive ElementHeader Element_LIFE static int update(UPDATE_FUNC_ARGS)
int Element_LIFE::update(UPDATE_FUNC_ARGS)
{
if (parts[i].tmp <= 0)
sim->kill_part(i);
return 0;
}
//#TPT-Directive ElementHeader Element_LIFE static int graphics(GRAPHICS_FUNC_ARGS) //#TPT-Directive ElementHeader Element_LIFE static int graphics(GRAPHICS_FUNC_ARGS)
int Element_LIFE::graphics(GRAPHICS_FUNC_ARGS) int Element_LIFE::graphics(GRAPHICS_FUNC_ARGS)

View File

@ -49,8 +49,6 @@ Element_PSTN::Element_PSTN()
//#TPT-Directive ElementHeader Element_PSTN static int tempParts[128]; //#TPT-Directive ElementHeader Element_PSTN static int tempParts[128];
int Element_PSTN::tempParts[128]; int Element_PSTN::tempParts[128];
//#TPT-Directive ElementHeader Element_PSTN static int tempPartAmount[128];
int Element_PSTN::tempPartAmount[128];
#define PISTON_INACTIVE 0x00 #define PISTON_INACTIVE 0x00
#define PISTON_RETRACT 0x01 #define PISTON_RETRACT 0x01