GoL is now affected by stasis wall

This commit is contained in:
jacob1
2019-02-20 23:25:28 -05:00
parent 45ee6780d9
commit 28bfa9dfc9

View File

@@ -4938,7 +4938,8 @@ void Simulation::SimulateGoL()
if (TYP(r) == PT_LIFE) if (TYP(r) == PT_LIFE)
{ {
int golnum = parts[ID(r)].ctype + 1; int golnum = parts[ID(r)].ctype + 1;
if (golnum<=0 || golnum>NGOL) { if (golnum <= 0 || golnum > NGOL)
{
kill_part(ID(r)); kill_part(ID(r));
continue; continue;
} }
@@ -4992,6 +4993,8 @@ void Simulation::SimulateGoL()
continue; continue;
int neighbors = gol2[ny][nx][0]; int neighbors = gol2[ny][nx][0];
if (neighbors) if (neighbors)
{
if (!(bmap[ny/CELL][nx/CELL] == WL_STASIS && emap[ny/CELL][nx/CELL] < 8))
{ {
int golnum = gol[ny][nx]; int golnum = gol[ny][nx];
if (!r) if (!r)
@@ -5004,7 +5007,8 @@ void Simulation::SimulateGoL()
golnum = (gol2[ny][nx][i]>>4); golnum = (gol2[ny][nx][i]>>4);
if (grule[golnum][neighbors]>= 2 && (gol2[ny][nx][i]&0xF) >= (neighbors%2)+neighbors/2) if (grule[golnum][neighbors]>= 2 && (gol2[ny][nx][i]&0xF) >= (neighbors%2)+neighbors/2)
{ {
if (golnum<creategol) creategol=golnum; if (golnum < creategol)
creategol = golnum;
} }
} }
if (creategol < 0xFF) if (creategol < 0xFF)
@@ -5015,6 +5019,7 @@ void Simulation::SimulateGoL()
if (parts[ID(r)].tmp == grule[golnum][9]-1) if (parts[ID(r)].tmp == grule[golnum][9]-1)
parts[ID(r)].tmp--; parts[ID(r)].tmp--;
} }
}
for (int z = 0; z < 9; z++) for (int z = 0; z < 9; 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.
} }