diff options
| author | jacob1 <jfu614@gmail.com> | 2013-08-30 02:18:35 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2013-08-30 02:18:35 (GMT) |
| commit | d38af2764c682370b4f604d54142b984fdd079cf (patch) | |
| tree | ba2c8b7c001798bf85f33ee3fd2e4922e47634c2 /src/simulation/elements | |
| parent | b17ef7f938808fe972030757921e958793a17943 (diff) | |
| download | powder-d38af2764c682370b4f604d54142b984fdd079cf.zip powder-d38af2764c682370b4f604d54142b984fdd079cf.tar.gz | |
move QRTZ .tmp into .tmp2 and .ctype into .tmp, fixes bug where sparking QRTZ resets .ctype and stops it from growing
Diffstat (limited to 'src/simulation/elements')
| -rw-r--r-- | src/simulation/elements/QRTZ.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/simulation/elements/QRTZ.cpp b/src/simulation/elements/QRTZ.cpp index 5eec6d6..b399662 100644 --- a/src/simulation/elements/QRTZ.cpp +++ b/src/simulation/elements/QRTZ.cpp @@ -60,7 +60,7 @@ int Element_QRTZ::update(UPDATE_FUNC_ARGS) } } // absorb SLTW - if (parts[i].ctype!=-1) + if (parts[i].tmp != -1) for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) if (BOUNDS_CHECK && (rx || ry)) @@ -71,15 +71,15 @@ int Element_QRTZ::update(UPDATE_FUNC_ARGS) else if ((r&0xFF)==PT_SLTW && !(rand()%500)) { sim->kill_part(r>>8); - parts[i].ctype ++; + parts[i].tmp++; } } // grow and diffuse - if (parts[i].ctype>0) + if (parts[i].tmp > 0) { - bool stopgrow=false; + bool stopgrow = false; int rnd, sry, srx; - for ( trade = 0; trade<9; trade ++) + for (trade = 0; trade < 9; trade++) { rnd = rand()%0x3FF; rx = (rnd%5)-2; @@ -91,20 +91,20 @@ int Element_QRTZ::update(UPDATE_FUNC_ARGS) { if (!stopgrow)//try to grow { - if (!pmap[y+sry][x+srx] && parts[i].ctype!=0) + if (!pmap[y+sry][x+srx] && parts[i].tmp!=0) { np = sim->create_part(-1,x+srx,y+sry,PT_QRTZ); if (np>-1) { - parts[np].tmp = parts[i].tmp; - parts[i].ctype--; + parts[np].tmp2 = parts[i].tmp2; + parts[i].tmp--; if (rand()%2) { - parts[np].ctype=-1;//dead qrtz + parts[np].tmp=-1;//dead qrtz } - else if (!parts[i].ctype && !(rand()%15)) + else if (!parts[i].tmp && !(rand()%15)) { - parts[i].ctype=-1; + parts[i].tmp=-1; } stopgrow=true; } @@ -114,19 +114,19 @@ int Element_QRTZ::update(UPDATE_FUNC_ARGS) r = pmap[y+ry][x+rx]; if (!r) continue; - else if ((r&0xFF)==PT_QRTZ && (parts[i].ctype>parts[r>>8].ctype) && parts[r>>8].ctype>=0) + else if ((r&0xFF)==PT_QRTZ && (parts[i].tmp>parts[r>>8].tmp) && parts[r>>8].tmp>=0) { - tmp = parts[i].ctype - parts[r>>8].ctype; + tmp = parts[i].tmp - parts[r>>8].tmp; if (tmp ==1) { - parts[r>>8].ctype ++; - parts[i].ctype --; + parts[r>>8].tmp++; + parts[i].tmp--; break; } if (tmp>0) { - parts[r>>8].ctype += tmp/2; - parts[i].ctype -= tmp/2; + parts[r>>8].tmp += tmp/2; + parts[i].tmp -= tmp/2; break; } } @@ -141,7 +141,7 @@ int Element_QRTZ::update(UPDATE_FUNC_ARGS) int Element_QRTZ::graphics(GRAPHICS_FUNC_ARGS) //QRTZ and PQRT { - int t = cpart->type, z = cpart->tmp - 5;//speckles! + int t = cpart->type, z = cpart->tmp2 - 5;//speckles! /*if (cpart->temp>(ptransitions[t].thv-800.0f))//hotglow for quartz { float frequency = 3.1415/(2*ptransitions[t].thv-(ptransitions[t].thv-800.0f)); |
