summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2011-05-12 17:33:29 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-05-14 12:44:44 (GMT)
commite675fb3cc18117bee065719afd390995e8494e87 (patch)
tree9c3f2fcce6dacd822ab5f1bf6773c4962d28abca /src
parentc4140955decd6a03e5a9020b52cf20c278a5b9b2 (diff)
downloadpowder-e675fb3cc18117bee065719afd390995e8494e87.zip
powder-e675fb3cc18117bee065719afd390995e8494e87.tar.gz
Fix crash with negative lava ctype
E.g. "set type prti lava"
Diffstat (limited to 'src')
-rw-r--r--src/powder.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/powder.c b/src/powder.c
index 63527b2..af333bb 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -1396,8 +1396,11 @@ void update_particles_i(pixel *vid, int start, int inc)
lx = parts[i].x;
ly = parts[i].y;
t = parts[i].type;
- if (t>=PT_NUM)
+ if (t<0 || t>=PT_NUM)
+ {
+ kill_part(i);
continue;
+ }
//printf("parts[%d].type: %d\n", i, parts[i].type);
if (parts[i].life>0 && (ptypes[t].properties&PROP_LIFE_DEC))
@@ -1599,7 +1602,7 @@ void update_particles_i(pixel *vid, int start, int inc)
else t = PT_DSTW;
}
else if (t==PT_LAVA) {
- if (parts[i].ctype && parts[i].ctype<PT_NUM && parts[i].ctype!=PT_LAVA) {
+ if (parts[i].ctype>0 && parts[i].ctype<PT_NUM && parts[i].ctype!=PT_LAVA) {
if (parts[i].ctype==PT_THRM&&pt>=ptransitions[PT_BMTL].thv) s = 0;
else if (ptransitions[parts[i].ctype].tht==PT_LAVA) {
if (pt>=ptransitions[parts[i].ctype].thv) s = 0;