summaryrefslogtreecommitdiff
path: root/src/elements/pcln.c
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2011-05-14 12:34:06 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-05-14 12:34:06 (GMT)
commit73f2f9f57fd6efa4ed386a86f5a8d118d879a629 (patch)
treee38f378c20c7107f178efae736465aebd27dae83 /src/elements/pcln.c
parentc23124e0d7f072e40701e1250618b295fb2117dc (diff)
downloadpowder-73f2f9f57fd6efa4ed386a86f5a8d118d879a629.zip
powder-73f2f9f57fd6efa4ed386a86f5a8d118d879a629.tar.gz
fix neutron cloning
Diffstat (limited to 'src/elements/pcln.c')
-rw-r--r--src/elements/pcln.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/elements/pcln.c b/src/elements/pcln.c
index e1c688e..5abe33f 100644
--- a/src/elements/pcln.c
+++ b/src/elements/pcln.c
@@ -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++) {