summaryrefslogtreecommitdiff
path: root/src/simulation/Simulation.cpp
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-03-03 20:38:52 (GMT)
committer jacob1 <jfu614@gmail.com>2013-03-03 20:38:52 (GMT)
commit17d79e8d8e585a39ca8b16efa1d18a11409f8079 (patch)
tree3dffb7755e0fec6065885df298db448b342def79 /src/simulation/Simulation.cpp
parent846d7d8064cf84c6b4e55a8a0417e7e605e0d144 (diff)
downloadpowder-17d79e8d8e585a39ca8b16efa1d18a11409f8079.zip
powder-17d79e8d8e585a39ca8b16efa1d18a11409f8079.tar.gz
fix crash when drawing particles in invalid coordinates (using console)
Diffstat (limited to 'src/simulation/Simulation.cpp')
-rw-r--r--src/simulation/Simulation.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp
index d64ccf7..ef3c3d9 100644
--- a/src/simulation/Simulation.cpp
+++ b/src/simulation/Simulation.cpp
@@ -2947,10 +2947,10 @@ int Simulation::create_part(int p, int x, int y, int tv)
parts[i].life = 75;
break;
/*Testing
- case PT_WOOD:
- parts[i].life = 150;
- break;
- End Testing*/
+ case PT_WOOD:
+ parts[i].life = 150;
+ break;
+ End Testing*/
case PT_WARP:
parts[i].life = rand()%95+70;
break;
@@ -3555,7 +3555,7 @@ void Simulation::update_particles_i(int start, int inc)
{
golnum = parts[r>>8].ctype+1;
if (golnum<=0 || golnum>NGOLALT) {
- parts[r>>8].type = PT_NONE;
+ kill_part(r>>8);
continue;
}
if (parts[r>>8].tmp == grule[golnum][9]-1) {
@@ -3575,7 +3575,7 @@ void Simulation::update_particles_i(int start, int inc)
} else {
parts[r>>8].tmp --;
if (parts[r>>8].tmp<=0)
- parts[r>>8].type = PT_NONE;//using kill_part makes it not work
+ kill_part(r>>8);
}
}
//}
@@ -3604,7 +3604,7 @@ void Simulation::update_particles_i(int start, int inc)
parts[r>>8].tmp --;
}
if (r && parts[r>>8].tmp<=0)
- parts[r>>8].type = PT_NONE;//using kill_part makes it not work
+ kill_part(r>>8);
}
for ( z = 0; z<=NGOL; z++)
gol2[ny][nx][z] = 0;//this improves performance A LOT compared to the memset, i was getting ~23 more fps with this.