fix CRAY(SPRK) bugs (?)

This commit is contained in:
jacob1 2013-03-06 14:23:26 -05:00
parent 037618e6f8
commit 9316054ab2
2 changed files with 6 additions and 4 deletions

View File

@ -314,5 +314,6 @@ PreviewModel::~PreviewModel() {
delete saveComments->at(i); delete saveComments->at(i);
delete saveComments; delete saveComments;
} }
saveDataBuffer.clear();
} }

View File

@ -78,8 +78,9 @@ int Element_CRAY::update(UPDATE_FUNC_ARGS)
continue; continue;
if ((r&0xFF)==PT_SPRK && parts[r>>8].life==3) { //spark found, start creating if ((r&0xFF)==PT_SPRK && parts[r>>8].life==3) { //spark found, start creating
unsigned int colored = 0; unsigned int colored = 0;
int destroy = (parts[r>>8].ctype==PT_PSCN)?1:0; bool destroy = parts[r>>8].ctype==PT_PSCN;
int nostop = (parts[r>>8].ctype==PT_INST)?1:0; bool nostop = parts[r>>8].ctype==PT_INST;
bool createSpark = (parts[r>>8].ctype==PT_INWR);
int partsRemaining = 255; int partsRemaining = 255;
if (parts[i].tmp) //how far it shoots if (parts[i].tmp) //how far it shoots
partsRemaining = parts[i].tmp; partsRemaining = parts[i].tmp;
@ -88,7 +89,7 @@ int Element_CRAY::update(UPDATE_FUNC_ARGS)
break; break;
} }
r = pmap[y+nyi+nyy][x+nxi+nxx]; r = pmap[y+nyi+nyy][x+nxi+nxx];
if (!sim->IsWallBlocking(x+nxi+nxx, y+nyi+nyy, parts[i].ctype) && (!sim->pmap[y+nyi+nyy][x+nxi+nxx] || (parts[i].ctype == PT_SPRK && parts[r>>8].type != PT_BREC && !destroy))) { // create, also set color if it has passed through FILT if (!sim->IsWallBlocking(x+nxi+nxx, y+nyi+nyy, parts[i].ctype) && (!sim->pmap[y+nyi+nyy][x+nxi+nxx] || createSpark)) { // create, also set color if it has passed through FILT
int nr; int nr;
if (parts[i].ctype == PT_LIFE) if (parts[i].ctype == PT_LIFE)
nr = sim->create_part(-1, x+nxi+nxx, y+nyi+nyy, parts[i].ctype|(parts[i].tmp2<<8)); nr = sim->create_part(-1, x+nxi+nxx, y+nyi+nyy, parts[i].ctype|(parts[i].tmp2<<8));
@ -98,7 +99,7 @@ int Element_CRAY::update(UPDATE_FUNC_ARGS)
parts[nr].dcolour = colored; parts[nr].dcolour = colored;
parts[nr].temp = parts[i].temp; parts[nr].temp = parts[i].temp;
} }
if((!destroy || (parts[i].ctype != PT_SPRK &&parts[r>>8].type != PT_BREC)) && !--partsRemaining) if(!--partsRemaining)
docontinue = 0; docontinue = 0;
} else if ((r&0xFF)==PT_FILT) { // get color if passed through FILT } else if ((r&0xFF)==PT_FILT) { // get color if passed through FILT
colored = wavelengthToDecoColour(parts[r>>8].ctype); colored = wavelengthToDecoColour(parts[r>>8].ctype);