diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-06-12 15:34:39 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-06-12 15:34:39 (GMT) |
| commit | 2633af01d7a515ad1b7d638850720a4ee88bd9a6 (patch) | |
| tree | f4e373ca4cf3ff35fc2ec3308916227a79eea4f1 /src/simulation/elements/SING.cpp | |
| parent | a270acfc54b3c4e555b7fd6c91093f96641cd52f (diff) | |
| download | powder-2633af01d7a515ad1b7d638850720a4ee88bd9a6.zip powder-2633af01d7a515ad1b7d638850720a4ee88bd9a6.tar.gz | |
TPT: Fix bounds checking for SING and make explosion pressure area smaller d7f798da60
Diffstat (limited to 'src/simulation/elements/SING.cpp')
| -rw-r--r-- | src/simulation/elements/SING.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/simulation/elements/SING.cpp b/src/simulation/elements/SING.cpp index ea0c8c7..8bd3f24 100644 --- a/src/simulation/elements/SING.cpp +++ b/src/simulation/elements/SING.cpp @@ -63,21 +63,21 @@ int Element_SING::update(UPDATE_FUNC_ARGS) if (y+CELL<YRES) sim->pv[y/CELL+1][x/CELL+1] += 0.1f*(singularity-sim->pv[y/CELL+1][x/CELL+1]); } - if (y+CELL>0 && sim->pv[y/CELL-1][x/CELL]<singularity) + if (y-CELL>=0 && sim->pv[y/CELL-1][x/CELL]<singularity) sim->pv[y/CELL-1][x/CELL] += 0.1f*(singularity-sim->pv[y/CELL-1][x/CELL]); - if (x+CELL>0) + if (x-CELL>=0) { sim->pv[y/CELL][x/CELL-1] += 0.1f*(singularity-sim->pv[y/CELL][x/CELL-1]); - if (y+CELL>0) + if (y-CELL>=0) sim->pv[y/CELL-1][x/CELL-1] += 0.1f*(singularity-sim->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)) { sim->pv[cry][crx] += (float)parts[i].tmp; } } @@ -152,4 +152,4 @@ int Element_SING::update(UPDATE_FUNC_ARGS) } -Element_SING::~Element_SING() {}
\ No newline at end of file +Element_SING::~Element_SING() {} |
