diff options
| author | jacksonmj <mj-pt@jacksonmj.co.uk> | 2012-02-05 13:39:04 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-02-10 18:18:09 (GMT) |
| commit | 91163c44ab601a733f889be72b7b9896e384ee51 (patch) | |
| tree | a101fc52f026be31209897b6be19a4fce61092f7 /src/elements | |
| parent | 161452783b2c118849ec019229e57ea5e87d4040 (diff) | |
| download | powder-91163c44ab601a733f889be72b7b9896e384ee51.zip powder-91163c44ab601a733f889be72b7b9896e384ee51.tar.gz | |
Fix stationary photons being created by PCLN/PBCN
Diffstat (limited to 'src/elements')
| -rw-r--r-- | src/elements/pbcn.c | 15 | ||||
| -rw-r--r-- | src/elements/pcln.c | 15 |
2 files changed, 20 insertions, 10 deletions
diff --git a/src/elements/pbcn.c b/src/elements/pbcn.c index 634a411..5fb361c 100644 --- a/src/elements/pbcn.c +++ b/src/elements/pbcn.c @@ -60,11 +60,16 @@ int update_PBCN(UPDATE_FUNC_ARGS) { if (parts[i].ctype>0 && parts[i].ctype<PT_NUM && parts[i].life==10) { if (parts[i].ctype==PT_PHOT) {//create photons a different way for (rx=-1; rx<2; rx++) { - for (ry=-1; ry<2; ry++) { - int r = create_part(-1, x+rx, y+ry, parts[i].ctype); - if (r!=-1) { - parts[r].vx = rx*3; - parts[r].vy = ry*3; + for (ry=-1; ry<2; ry++) + { + if (rx || ry) + { + int r = create_part(-1, x+rx, y+ry, parts[i].ctype); + if (r!=-1) + { + parts[r].vx = rx*3; + parts[r].vy = ry*3; + } } } } diff --git a/src/elements/pcln.c b/src/elements/pcln.c index aff8e76..1972632 100644 --- a/src/elements/pcln.c +++ b/src/elements/pcln.c @@ -50,11 +50,16 @@ int update_PCLN(UPDATE_FUNC_ARGS) { if (parts[i].ctype>0 && parts[i].ctype<PT_NUM && parts[i].life==10) { if (parts[i].ctype==PT_PHOT) {//create photons a different way for (rx=-1; rx<2; rx++) { - for (ry=-1; ry<2; ry++) { - int r = create_part(-1, x+rx, y+ry, parts[i].ctype); - if (r!=-1) { - parts[r].vx = rx*3; - parts[r].vy = ry*3; + for (ry=-1; ry<2; ry++) + { + if (rx || ry) + { + int r = create_part(-1, x+rx, y+ry, parts[i].ctype); + if (r!=-1) + { + parts[r].vx = rx*3; + parts[r].vy = ry*3; + } } } } |
