From b88a2f680e638d7fbf396482b567ca5b6a7314f6 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Tue, 17 Apr 2012 17:24:51 +0100 Subject: TPT: More SPRK life checks for electronic elements 68ab3ca3ca diff --git a/src/elements/aray.cpp b/src/elements/aray.cpp index 939d3c1..dd4a80b 100644 --- a/src/elements/aray.cpp +++ b/src/elements/aray.cpp @@ -11,7 +11,7 @@ int update_ARAY(UPDATE_FUNC_ARGS) { r = pmap[y+ry][x+rx]; if (!r) continue; - if ((r&0xFF)==PT_SPRK && parts[r>>8].life<4) { + if ((r&0xFF)==PT_SPRK && parts[r>>8].life>0 && parts[r>>8].life<4) { int destroy = (parts[r>>8].ctype==PT_PSCN)?1:0; int nostop = (parts[r>>8].ctype==PT_INST)?1:0; for (docontinue = 1, nxx = 0, nyy = 0, nxi = rx*-1, nyi = ry*-1; docontinue; nyy+=nyi, nxx+=nxi) { diff --git a/src/elements/dlay.cpp b/src/elements/dlay.cpp index 7823fad..06b59d9 100644 --- a/src/elements/dlay.cpp +++ b/src/elements/dlay.cpp @@ -19,7 +19,7 @@ int update_DLAY(UPDATE_FUNC_ARGS) { r = pmap[y+ry][x+rx]; if (!r) continue; - if ((r&0xFF)==PT_SPRK && parts[i].life==0 && parts[r>>8].life<4 && parts[r>>8].ctype==PT_PSCN) + if ((r&0xFF)==PT_SPRK && parts[i].life==0 && parts[r>>8].life>0 && parts[r>>8].life<4 && parts[r>>8].ctype==PT_PSCN) { parts[i].life = (int)(parts[i].temp-273.15); } diff --git a/src/elements/emp.cpp b/src/elements/emp.cpp index a0b8107..6625610 100644 --- a/src/elements/emp.cpp +++ b/src/elements/emp.cpp @@ -11,7 +11,7 @@ int update_EMP(UPDATE_FUNC_ARGS) { r = pmap[y+ry][x+rx]; if (!r) continue; - if ((r&0xFF)==PT_SPRK && parts[r>>8].life<4) + if ((r&0xFF)==PT_SPRK && parts[r>>8].life>0 && parts[r>>8].life<4) { ok=1; break; diff --git a/src/elements/pcln.cpp b/src/elements/pcln.cpp index 3b4cde0..86d67f6 100644 --- a/src/elements/pcln.cpp +++ b/src/elements/pcln.cpp @@ -11,7 +11,7 @@ int update_PCLN(UPDATE_FUNC_ARGS) { r = pmap[y+ry][x+rx]; if (!r) continue; - if ((r&0xFF)==PT_SPRK && parts[r>>8].life<4) + if ((r&0xFF)==PT_SPRK && parts[r>>8].life>0 && parts[r>>8].life<4) { if (parts[r>>8].ctype==PT_PSCN) parts[i].life = 10; diff --git a/src/elements/pvod.cpp b/src/elements/pvod.cpp index c65643e..921d596 100644 --- a/src/elements/pvod.cpp +++ b/src/elements/pvod.cpp @@ -11,7 +11,7 @@ int update_PVOD(UPDATE_FUNC_ARGS) { r = pmap[y+ry][x+rx]; if (!r) continue; - if ((r&0xFF)==PT_SPRK && parts[r>>8].life<4) + if ((r&0xFF)==PT_SPRK && parts[r>>8].life>0 && parts[r>>8].life<4) { if (parts[r>>8].ctype==PT_PSCN) parts[i].life = 10; diff --git a/src/elements/stor.cpp b/src/elements/stor.cpp index 555122c..cf64255 100644 --- a/src/elements/stor.cpp +++ b/src/elements/stor.cpp @@ -20,7 +20,7 @@ int update_STOR(UPDATE_FUNC_ARGS) { parts[i].pavg[1] = parts[r>>8].ctype; sim->kill_part(r>>8); } - if(parts[i].tmp && (r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_PSCN && parts[r>>8].life<4) + if(parts[i].tmp && (r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_PSCN && parts[r>>8].life>0 && parts[r>>8].life<4) { for(ry1 = 1; ry1 >= -1; ry1--){ for(rx1 = 0; rx1 >= -1 && rx1 <= 1; rx1 = -rx1-rx1+1){ // Oscilate the X starting at 0, 1, -1, 3, -5, etc (Though stop at -1) diff --git a/src/elements/wire.cpp b/src/elements/wire.cpp index 4e5d072..88d2a5e 100644 --- a/src/elements/wire.cpp +++ b/src/elements/wire.cpp @@ -29,10 +29,9 @@ int update_WIRE(UPDATE_FUNC_ARGS) { r = pmap[y+ry][x+rx]; if (!r) continue; - if((r&0xFF)==PT_SPRK && parts[r>>8].life<4 && parts[r>>8].ctype==PT_PSCN) + if((r&0xFF)==PT_SPRK && parts[r>>8].life==3 && parts[r>>8].ctype==PT_PSCN) { parts[i].ctype=1; - parts[r>>8].life=0; return 0; } else if((r&0xFF)==PT_NSCN && parts[i].tmp==1){sim->create_part(-1, x+rx, y+ry, PT_SPRK);} -- cgit v0.9.2-21-gd62e