TPT: Fix stationary photons being created by PCLN/PBCN 91163c44ab

This commit is contained in:
Simon Robertshaw 2012-04-17 17:42:09 +01:00
parent fd09db2345
commit 7682094f13
2 changed files with 26 additions and 12 deletions

View File

@ -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>0 && parts[i].ctype<PT_NUM && parts[i].life==10) {
if (parts[i].ctype==PT_PHOT) {//create photons a different way if (parts[i].ctype==PT_PHOT) {//create photons a different way
for (rx=-1; rx<2; rx++) { 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); for (ry = -1; ry < 2; ry++)
if (r!=-1) { {
parts[r].vx = rx*3; if (rx || ry)
parts[r].vy = ry*3; {
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;
}
} }
} }
} }

View File

@ -49,12 +49,19 @@ int update_PCLN(UPDATE_FUNC_ARGS) {
} }
if (parts[i].ctype>0 && parts[i].ctype<PT_NUM && parts[i].life==10) { 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 if (parts[i].ctype==PT_PHOT) {//create photons a different way
for (rx=-1; rx<2; rx++) { 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); for (ry = -1; ry < 2; ry++)
if (r!=-1) { {
parts[r].vx = rx*3; if (rx || ry)
parts[r].vy = ry*3; {
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;
}
} }
} }
} }