diff options
| author | jacksonmj <mj-pt@jacksonmj.co.uk> | 2012-04-29 00:37:52 (GMT) |
|---|---|---|
| committer | jacksonmj <mj-pt@jacksonmj.co.uk> | 2012-04-29 00:37:52 (GMT) |
| commit | d7f798da60ac6844dd386ee1f4a0145c4d18a8ec (patch) | |
| tree | 877163d4ba316c04b4c9f4f22e0dd08036194d44 /src/elements | |
| parent | 38057065c2b18bd455f150e32348a266ecfc1355 (diff) | |
| download | powder-d7f798da60ac6844dd386ee1f4a0145c4d18a8ec.zip powder-d7f798da60ac6844dd386ee1f4a0145c4d18a8ec.tar.gz | |
Fix bounds checking for SING and make explosion pressure area smaller
Making the area smaller means a bit less pressure is generated, but it
does stop the pressure going through walls
Diffstat (limited to 'src/elements')
| -rw-r--r-- | src/elements/sing.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/elements/sing.c b/src/elements/sing.c index d6fc273..3e17fe0 100644 --- a/src/elements/sing.c +++ b/src/elements/sing.c @@ -15,21 +15,21 @@ int update_SING(UPDATE_FUNC_ARGS) { if (y+CELL<YRES) pv[y/CELL+1][x/CELL+1] += 0.1f*(singularity-pv[y/CELL+1][x/CELL+1]); } - if (y+CELL>0 && pv[y/CELL-1][x/CELL]<singularity) + if (y-CELL>=0 && pv[y/CELL-1][x/CELL]<singularity) pv[y/CELL-1][x/CELL] += 0.1f*(singularity-pv[y/CELL-1][x/CELL]); - if (x+CELL>0) + if (x-CELL>=0) { pv[y/CELL][x/CELL-1] += 0.1f*(singularity-pv[y/CELL][x/CELL-1]); - if (y+CELL>0) + if (y-CELL>=0) pv[y/CELL-1][x/CELL-1] += 0.1f*(singularity-pv[y/CELL-1][x/CELL-1]); } if (parts[i].life<1) { //Pop! - for (rx=-2; rx<3; rx++) { + for (rx=-1; rx<2; rx++) { crx = (x/CELL)+rx; - for (ry=-2; ry<3; ry++) { + for (ry=-1; ry<2; ry++) { cry = (y/CELL)+ry; - if (cry > 0 && crx > 0 && crx < (XRES/CELL) && cry < (YRES/CELL)) { + if (cry >= 0 && crx >= 0 && crx < (XRES/CELL) && cry < (YRES/CELL)) { pv[cry][crx] += (float)parts[i].tmp; } } |
