summaryrefslogtreecommitdiff
path: root/src/elements/pbcn.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-04-17 16:42:09 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-04-17 16:42:29 (GMT)
commit7682094f1303dc2a7a64888a397394953f326697 (patch)
treef52a67dd42cd0bfb9192cc1c4890d544ea95bad8 /src/elements/pbcn.cpp
parentfd09db2345b21632a658d1e7fad6694578ef8274 (diff)
downloadpowder-7682094f1303dc2a7a64888a397394953f326697.zip
powder-7682094f1303dc2a7a64888a397394953f326697.tar.gz
TPT: Fix stationary photons being created by PCLN/PBCN 91163c44ab
Diffstat (limited to 'src/elements/pbcn.cpp')
-rw-r--r--src/elements/pbcn.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/elements/pbcn.cpp b/src/elements/pbcn.cpp
index a6bbe5a..aa4c336 100644
--- a/src/elements/pbcn.cpp
+++ b/src/elements/pbcn.cpp
@@ -59,12 +59,19 @@ 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 = sim->create_part(-1, x+rx, y+ry, parts[i].ctype);
- if (r!=-1) {
- parts[r].vx = rx*3;
- parts[r].vy = ry*3;
+ for (rx=-1; rx<2; rx++)
+ {
+ for (ry = -1; ry < 2; ry++)
+ {
+ if (rx || ry)
+ {
+ int r = sim->create_part(-1, x + rx, y + ry,
+ parts[i].ctype);
+ if (r != -1)
+ {
+ parts[r].vx = rx * 3;
+ parts[r].vy = ry * 3;
+ }
}
}
}