Fix built-in GOL types

This commit is contained in:
Tamás Bálint Misius 2020-10-12 17:36:24 +02:00
parent f57d503b41
commit 5a5eace691
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2

View File

@ -84,16 +84,19 @@ static int graphics(GRAPHICS_FUNC_ARGS)
static void create(ELEMENT_CREATE_FUNC_ARGS)
{
sim->parts[i].ctype = v & 0x1FFFFF;
// * 0x200000: No need to look for colours, they'll be set later anyway.
bool skipLookup = v & 0x200000;
v &= 0x1FFFFF;
sim->parts[i].ctype = v;
if (v < NGOL)
{
sim->parts[i].dcolour = builtinGol[v].colour;
sim->parts[i].tmp = builtinGol[v].colour2;
v = builtinGol[v].ruleset;
}
else if (!(v & 0x200000)) // * 0x200000: No need to look for colours, they'll be set later anyway.
else if (!skipLookup)
{
auto *cgol = sim->GetCustomGOLByRule(v & 0x1FFFFF);
auto *cgol = sim->GetCustomGOLByRule(v);
if (cgol)
{
sim->parts[i].dcolour = cgol->colour1;