fix neutron cloning
This commit is contained in:
parent
c23124e0d7
commit
73f2f9f57f
@ -11,18 +11,21 @@ int update_BCLN(UPDATE_FUNC_ARGS) {
|
||||
}
|
||||
if (!parts[i].ctype)
|
||||
{
|
||||
int rx, ry;
|
||||
int r, rx, ry;
|
||||
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 &&
|
||||
pmap[y+ry][x+rx] &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=PT_CLNE &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=PT_BCLN &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=PT_PCLN &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=PT_STKM &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=PT_STKM2 &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=0xFF)
|
||||
parts[i].ctype = pmap[y+ry][x+rx]&0xFF;
|
||||
if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES)
|
||||
{
|
||||
r = photons[y+ry][x+rx];
|
||||
if (!r || (r>>8)>=NPART)
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r || (r>>8)>=NPART)
|
||||
continue;
|
||||
if ((r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN &&
|
||||
(r&0xFF)!=PT_BCLN && (r&0xFF)!=PT_STKM &&
|
||||
(r&0xFF)!=PT_STKM2 && (r&0xFF)<PT_NUM)
|
||||
parts[i].ctype = r&0xFF;
|
||||
}
|
||||
}
|
||||
else {
|
||||
create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
|
||||
|
@ -3,18 +3,21 @@
|
||||
int update_CLNE(UPDATE_FUNC_ARGS) {
|
||||
if (!parts[i].ctype)
|
||||
{
|
||||
int rx, ry;
|
||||
int r, rx, ry;
|
||||
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 &&
|
||||
pmap[y+ry][x+rx] &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=PT_CLNE &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=PT_BCLN &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=PT_PCLN &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=PT_STKM &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=PT_STKM2 &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=0xFF)
|
||||
parts[i].ctype = pmap[y+ry][x+rx]&0xFF;
|
||||
if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES)
|
||||
{
|
||||
r = photons[y+ry][x+rx];
|
||||
if (!r || (r>>8)>=NPART)
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r || (r>>8)>=NPART)
|
||||
continue;
|
||||
if ((r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN &&
|
||||
(r&0xFF)!=PT_BCLN && (r&0xFF)!=PT_STKM &&
|
||||
(r&0xFF)!=PT_STKM2 && (r&0xFF)<PT_NUM)
|
||||
parts[i].ctype = r&0xFF;
|
||||
}
|
||||
}
|
||||
else {
|
||||
create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
|
||||
|
@ -132,11 +132,5 @@ int update_NEUT(UPDATE_FUNC_ARGS) {
|
||||
ptypes[parts[r>>8].type-1].menusection==SC_POWDERS) && 15>(rand()%1000))
|
||||
parts[r>>8].type--;*/
|
||||
}
|
||||
r = pmap[y][x];
|
||||
rt = r&0xFF;
|
||||
if (rt==PT_CLNE || rt==PT_PCLN || rt==PT_BCLN) {
|
||||
if (!parts[r>>8].ctype)
|
||||
parts[r>>8].ctype = PT_PHOT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -27,18 +27,20 @@ int update_PCLN(UPDATE_FUNC_ARGS) {
|
||||
if (!parts[i].ctype)
|
||||
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 &&
|
||||
pmap[y+ry][x+rx] &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=PT_CLNE &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=PT_PCLN &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=PT_BCLN &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=PT_SPRK &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=PT_NSCN &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=PT_PSCN &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=PT_STKM &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=PT_STKM2 &&
|
||||
(pmap[y+ry][x+rx]&0xFF)!=0xFF)
|
||||
parts[i].ctype = pmap[y+ry][x+rx]&0xFF;
|
||||
if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES)
|
||||
{
|
||||
r = photons[y+ry][x+rx];
|
||||
if (!r || (r>>8)>=NPART)
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r || (r>>8)>=NPART)
|
||||
continue;
|
||||
if ((r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN &&
|
||||
(r&0xFF)!=PT_BCLN && (r&0xFF)!=PT_SPRK &&
|
||||
(r&0xFF)!=PT_NSCN && (r&0xFF)!=PT_PSCN &&
|
||||
(r&0xFF)!=PT_STKM && (r&0xFF)!=PT_STKM2 &&
|
||||
(r&0xFF)<PT_NUM)
|
||||
parts[i].ctype = r&0xFF;
|
||||
}
|
||||
if (parts[i].ctype && parts[i].life==10) {
|
||||
if (parts[i].ctype==PT_PHOT) {//create photons a different way
|
||||
for (rx=-1; rx<2; rx++) {
|
||||
|
@ -168,6 +168,10 @@ int try_move(int i, int x, int y, int nx, int ny)
|
||||
if ((r & 0xFF) < PT_NUM && ptypes[r&0xFF].hconduct)
|
||||
parts[i].temp = parts[r>>8].temp = restrict_flt((parts[r>>8].temp+parts[i].temp)/2, MIN_TEMP, MAX_TEMP);
|
||||
}
|
||||
if (parts[i].type==PT_NEUT && ((r&0xFF)==PT_CLNE || (r&0xFF)==PT_PCLN || (r&0xFF)==PT_BCLN)) {
|
||||
if (!parts[r>>8].ctype)
|
||||
parts[r>>8].ctype = PT_NEUT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -250,7 +254,8 @@ int try_move(int i, int x, int y, int nx, int ny)
|
||||
|
||||
return 0;
|
||||
}
|
||||
if ((r&0xFF)==PT_CNCT)//stops CNCT being displaced by other particles
|
||||
|
||||
if ((pmap[ny][nx]&0xFF)==PT_CNCT)//stops CNCT being displaced by other particles
|
||||
return 0;
|
||||
if (parts[i].type==PT_CNCT && y<ny && (pmap[y+1][x]&0xFF)==PT_CNCT)//check below CNCT for another CNCT
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user