diff options
| author | cracker64 <cracker642@gmail.com> | 2013-02-26 23:59:37 (GMT) |
|---|---|---|
| committer | cracker64 <cracker642@gmail.com> | 2013-02-26 23:59:37 (GMT) |
| commit | 8250515e97db5ace3e87c612d855f09235b73969 (patch) | |
| tree | ddbc36591a9043334b2fc684722ffd334894da83 /src/simulation/elements/CONV.cpp | |
| parent | e700ff29883fcc3479ad8d9fce9805fbb0d31dfa (diff) | |
| download | powder-8250515e97db5ace3e87c612d855f09235b73969.zip powder-8250515e97db5ace3e87c612d855f09235b73969.tar.gz | |
Lots of small optimizations and things, nothing should be functionally different.
Only gotten through a few elements, more later.
Diffstat (limited to 'src/simulation/elements/CONV.cpp')
| -rw-r--r-- | src/simulation/elements/CONV.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/simulation/elements/CONV.cpp b/src/simulation/elements/CONV.cpp index 6577516..8f2f0c6 100644 --- a/src/simulation/elements/CONV.cpp +++ b/src/simulation/elements/CONV.cpp @@ -50,7 +50,7 @@ Element_CONV::Element_CONV() int Element_CONV::update(UPDATE_FUNC_ARGS) { int r, rx, ry; - if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || !sim->elements[parts[i].ctype].Enabled || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) + if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || !sim->elements[parts[i].ctype].Enabled || parts[i].ctype==PT_CONV || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) { for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) @@ -72,7 +72,9 @@ int Element_CONV::update(UPDATE_FUNC_ARGS) } } } - else if(parts[i].ctype>0 && parts[i].ctype<PT_NUM && sim->elements[parts[i].ctype].Enabled && parts[i].ctype!=PT_CONV) { + else + { + bool life = parts[i].ctype==PT_LIFE; for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES) @@ -84,7 +86,7 @@ int Element_CONV::update(UPDATE_FUNC_ARGS) continue; if((r&0xFF)!=PT_CONV && (r&0xFF)!=PT_DMND && (r&0xFF)!=parts[i].ctype) { - if (parts[i].ctype==PT_LIFE) sim->create_part(r>>8, x+rx, y+ry, parts[i].ctype|(parts[i].tmp<<8)); + if (life) sim->create_part(r>>8, x+rx, y+ry, parts[i].ctype|(parts[i].tmp<<8)); else sim->create_part(r>>8, x+rx, y+ry, parts[i].ctype); } } @@ -93,4 +95,4 @@ int Element_CONV::update(UPDATE_FUNC_ARGS) } -Element_CONV::~Element_CONV() {}
\ No newline at end of file +Element_CONV::~Element_CONV() {} |
