From 5040b80717cf8f86c6703d9d5c12f4e94bfbb932 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 7 Oct 2010 19:12:01 +0100 Subject: [PATCH] Attempt at fixing fuse crashes --- src/powder.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/powder.c b/src/powder.c index 8cd0f73c4..9b008f7cf 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1352,16 +1352,18 @@ void update_particles_i(pixel *vid, int start, int inc) else if(t==PT_FUSE) { if(parts[i].life<=0) { - t = PT_NONE; + //t = parts[i].life = PT_NONE; kill_part(i); r = create_part(-1, x, y, PT_PLSM); - parts[r].life = 50; - goto killed; + if(r!=-1) + parts[r].life = 50; + //goto killed; } else if (parts[i].life < 40) { parts[i].life--; if((rand()%100)==0) { r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); - parts[r].life = 50; + if(r!=-1) + parts[r].life = 50; } } if((pv[y/CELL][x/CELL] > 2.7f)&&parts[i].tmp>40) @@ -1369,10 +1371,10 @@ void update_particles_i(pixel *vid, int start, int inc) else if(parts[i].tmp<40&&parts[i].tmp>0) parts[i].tmp--; else if(parts[i].tmp<=0) { - t = PT_NONE; + //t = PT_NONE; kill_part(i); r = create_part(-1, x, y, PT_FSEP); - goto killed; + //goto killed; } for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) @@ -1393,16 +1395,18 @@ void update_particles_i(pixel *vid, int start, int inc) else if(t==PT_FSEP) { if(parts[i].life<=0) { - t = PT_NONE; + //t = PT_NONE; kill_part(i); r = create_part(-1, x, y, PT_PLSM); - parts[r].life = 50; - goto killed; + if(r!=-1) + parts[r].life = 50; + //goto killed; } else if (parts[i].life < 40) { parts[i].life--; if((rand()%10)==0) { r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); - parts[r].life = 50; + if(r!=-1) + parts[r].life = 50; } } for(nx=-2; nx<3; nx++)