summaryrefslogtreecommitdiff
path: root/src/simulation/elements
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-01-24 02:54:15 (GMT)
committer jacob1 <jfu614@gmail.com>2013-01-24 02:54:15 (GMT)
commitea38fc2d8662f62e30344a3f9a8d71771ca8bb8a (patch)
tree4b4ebb9b3d9e89e6891ded7d7899a4a4e58d794a /src/simulation/elements
parentc5eecff13133bc20987ddc0a52bf133f4dd83d06 (diff)
downloadpowder-ea38fc2d8662f62e30344a3f9a8d71771ca8bb8a.zip
powder-ea38fc2d8662f62e30344a3f9a8d71771ca8bb8a.tar.gz
fix possible crash with LIGH
Diffstat (limited to 'src/simulation/elements')
-rw-r--r--src/simulation/elements/LIGH.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/simulation/elements/LIGH.cpp b/src/simulation/elements/LIGH.cpp
index f697ebe..a6b77de 100644
--- a/src/simulation/elements/LIGH.cpp
+++ b/src/simulation/elements/LIGH.cpp
@@ -296,7 +296,7 @@ bool Element_LIGH::create_LIGH(Simulation * sim, int x, int y, int c, int temp,
sim->parts[p].tmp = tmp;
sim->parts[p].tmp2 = tmp2;
}
- else
+ else if (x >= 0 && x < XRES && y >= 0 && y < YRES)
{
int r = sim->pmap[y][x];
if ((((r&0xFF)==PT_VOID || ((r&0xFF)==PT_PVOD && sim->parts[r>>8].life >= 10)) && (!sim->parts[r>>8].ctype || (sim->parts[r>>8].ctype==c)!=(sim->parts[r>>8].tmp&1))) || (r&0xFF)==PT_BHOL || (r&0xFF)==PT_NBHL) // VOID, PVOD, VACU, and BHOL eat LIGH here