summaryrefslogtreecommitdiff
path: root/src/simulation
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-07-29 04:34:43 (GMT)
committer jacob1 <jfu614@gmail.com>2013-07-29 04:34:43 (GMT)
commit47464741277533ba6669ba96b716d77e9ec90441 (patch)
tree93daeb0111ab25ae52dce083933b5909231f0b59 /src/simulation
parentbd0b779bd06b49ee1ef3e9cfca07ea6cecb587a2 (diff)
downloadpowder-47464741277533ba6669ba96b716d77e9ec90441.zip
powder-47464741277533ba6669ba96b716d77e9ec90441.tar.gz
fix occasional crash when flood fill deleting
Diffstat (limited to 'src/simulation')
-rw-r--r--src/simulation/Simulation.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp
index 53244e0..c1cf22e 100644
--- a/src/simulation/Simulation.cpp
+++ b/src/simulation/Simulation.cpp
@@ -1419,7 +1419,7 @@ int Simulation::FloodParts(int x, int y, int fullc, int cm, int flags)
unsigned short (*coord_stack)[2];
int coord_stack_size = 0;
int created_something = 0;
-
+
if (cm==-1)
{
//if initial flood point is out of bounds, do nothing
@@ -1432,8 +1432,13 @@ int Simulation::FloodParts(int x, int y, int fullc, int cm, int flags)
cm = pmap[y][x]&0xFF;
if (!cm)
cm = photons[y][x]&0xFF;
- if (!cm && bmap[y/CELL][x/CELL])
- FloodWalls(x, y, WL_ERASE, -1);
+ if (!cm)
+ {
+ if (bmap[y/CELL][x/CELL])
+ return FloodWalls(x, y, WL_ERASE, -1);
+ else
+ return -1;
+ }
}
else
cm = 0;