Fix GOL showing up where it shouldn't
The underlying problem was that the spreading step in SimulateGOL would record activity concerning a cell to builtinGol even if said cell already housed a non-GOL particle. The culling step handles these records and purges them once it's done (thus builtinGol only ever has non-zero values inside SimulateGOL), except in this case, it saw the non-GOL particle and skipped the cell without purging the corresponding records. This would later let GOL spread seemingly out of nowhere.
This commit is contained in:
parent
34615536ce
commit
cfeda0fdba
@ -4852,6 +4852,10 @@ void Simulation::SimulateGoL()
|
|||||||
// this a bit awkward.
|
// this a bit awkward.
|
||||||
int ax = ((x + xx + XRES - 3 * CELL) % (XRES - 2 * CELL)) + CELL;
|
int ax = ((x + xx + XRES - 3 * CELL) % (XRES - 2 * CELL)) + CELL;
|
||||||
int ay = ((y + yy + YRES - 3 * CELL) % (YRES - 2 * CELL)) + CELL;
|
int ay = ((y + yy + YRES - 3 * CELL) % (YRES - 2 * CELL)) + CELL;
|
||||||
|
if (pmap[ay][ax] && TYP(pmap[ay][ax]) != PT_LIFE)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
unsigned int (&neighbourList)[5] = gol[ay][ax];
|
unsigned int (&neighbourList)[5] = gol[ay][ax];
|
||||||
// * Bump overall neighbour counter (bits 30..28) for the entire list.
|
// * Bump overall neighbour counter (bits 30..28) for the entire list.
|
||||||
neighbourList[0] += 1U << 28;
|
neighbourList[0] += 1U << 28;
|
||||||
|
Reference in New Issue
Block a user