Don't show GoL .tmp in HUD, check if create_part was successful while simulating GoL

This commit is contained in:
jacob1 2021-05-11 23:40:31 -04:00
parent 829c0bced5
commit a25fa700e2
No known key found for this signature in database
GPG Key ID: 4E58A32D510E1995
2 changed files with 13 additions and 10 deletions

View File

@ -2191,7 +2191,7 @@ void GameView::OnDraw()
} }
sampleInfo << ", Temp: " << (sample.particle.temp - 273.15f) << " C"; sampleInfo << ", Temp: " << (sample.particle.temp - 273.15f) << " C";
sampleInfo << ", Life: " << sample.particle.life; sampleInfo << ", Life: " << sample.particle.life;
if (sample.particle.type != PT_RFRG && sample.particle.type != PT_RFGL) if (sample.particle.type != PT_RFRG && sample.particle.type != PT_RFGL && sample.particle.type != PT_LIFE)
{ {
if (sample.particle.type == PT_CONV) if (sample.particle.type == PT_CONV)
{ {

View File

@ -4947,15 +4947,18 @@ void Simulation::SimulateGoL()
{ {
// * 0x200000: No need to look for colours, they'll be set later anyway. // * 0x200000: No need to look for colours, they'll be set later anyway.
int i = create_part(-1, x, y, PT_LIFE, golnumToCreate | 0x200000); int i = create_part(-1, x, y, PT_LIFE, golnumToCreate | 0x200000);
int xx = (createFromEntry >> 24) & 3; if (i >= 0)
int yy = (createFromEntry >> 26) & 3; {
if (xx == 3) xx = -1; int xx = (createFromEntry >> 24) & 3;
if (yy == 3) yy = -1; int yy = (createFromEntry >> 26) & 3;
int ax = ((x - xx + XRES - 3 * CELL) % (XRES - 2 * CELL)) + CELL; if (xx == 3) xx = -1;
int ay = ((y - yy + YRES - 3 * CELL) % (YRES - 2 * CELL)) + CELL; if (yy == 3) yy = -1;
auto &sample = parts[ID(pmap[ay][ax])]; int ax = ((x - xx + XRES - 3 * CELL) % (XRES - 2 * CELL)) + CELL;
parts[i].dcolour = sample.dcolour; int ay = ((y - yy + YRES - 3 * CELL) % (YRES - 2 * CELL)) + CELL;
parts[i].tmp = sample.tmp; auto &sample = parts[ID(pmap[ay][ax])];
parts[i].dcolour = sample.dcolour;
parts[i].tmp = sample.tmp;
}
} }
} }
} }