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:
Tamás Bálint Misius 2021-07-11 12:21:48 +02:00
parent 34615536ce
commit cfeda0fdba
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2

View File

@ -4852,6 +4852,10 @@ void Simulation::SimulateGoL()
// this a bit awkward.
int ax = ((x + xx + XRES - 3 * CELL) % (XRES - 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];
// * Bump overall neighbour counter (bits 30..28) for the entire list.
neighbourList[0] += 1U << 28;