reset colored and partsRemaining, to fix bugs when CRAY is sparked multiple times at once
This commit is contained in:
parent
74387040a1
commit
2184d35b28
@ -49,9 +49,7 @@ Element_CRAY::Element_CRAY()
|
||||
//#TPT-Directive ElementHeader Element_CRAY static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_CRAY::update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, nxx, nyy, docontinue, nxi, nyi, rx, ry, nr, ry1, rx1, partsRemaining = 255;
|
||||
if (parts[i].tmp) //how far it shoots
|
||||
partsRemaining = parts[i].tmp;
|
||||
int r, nxx, nyy, docontinue, nxi, nyi, rx, ry, nr, ry1, rx1;
|
||||
// set ctype to things that touch it if it doesn't have one already
|
||||
if(parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || !sim->elements[parts[i].ctype].Enabled) {
|
||||
int r, rx, ry;
|
||||
@ -70,7 +68,6 @@ int Element_CRAY::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
}
|
||||
} else if (parts[i].life==0) { // only fire when life is 0, but nothing sets the life right now
|
||||
unsigned int colored = 0;
|
||||
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 && (rx || ry))
|
||||
@ -79,8 +76,12 @@ int Element_CRAY::update(UPDATE_FUNC_ARGS)
|
||||
if (!r)
|
||||
continue;
|
||||
if ((r&0xFF)==PT_SPRK && parts[r>>8].life==3) { //spark found, start creating
|
||||
unsigned int colored = 0;
|
||||
int destroy = (parts[r>>8].ctype==PT_PSCN)?1:0;
|
||||
int nostop = (parts[r>>8].ctype==PT_INST)?1:0;
|
||||
int partsRemaining = 255;
|
||||
if (parts[i].tmp) //how far it shoots
|
||||
partsRemaining = parts[i].tmp;
|
||||
for (docontinue = 1, nxx = 0, nyy = 0, nxi = rx*-1, nyi = ry*-1; docontinue; nyy+=nyi, nxx+=nxi) {
|
||||
if (!(x+nxi+nxx<XRES && y+nyi+nyy<YRES && x+nxi+nxx >= 0 && y+nyi+nyy >= 0)) {
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user