diff options
| author | jacksonmj <mj-pt@jacksonmj.co.uk> | 2012-07-09 19:09:29 (GMT) |
|---|---|---|
| committer | jacksonmj <mj-pt@jacksonmj.co.uk> | 2012-07-09 19:09:29 (GMT) |
| commit | 61f39f5464f4f5d39c76f8427127e8998cc8e618 (patch) | |
| tree | 54b17c4f7d792aa172b22b83ff8a972b4deaa9cd /src/elements | |
| parent | 3e1d3cd5a6382f1ad7dacee48cfee04188601670 (diff) | |
| download | powder-61f39f5464f4f5d39c76f8427127e8998cc8e618.zip powder-61f39f5464f4f5d39c76f8427127e8998cc8e618.tar.gz | |
Add ptypes.enabled checks to a few more places
Diffstat (limited to 'src/elements')
| -rw-r--r-- | src/elements/bcln.c | 2 | ||||
| -rw-r--r-- | src/elements/clne.c | 2 | ||||
| -rw-r--r-- | src/elements/conv.c | 4 | ||||
| -rw-r--r-- | src/elements/neut.c | 2 | ||||
| -rw-r--r-- | src/elements/pbcn.c | 4 | ||||
| -rw-r--r-- | src/elements/pcln.c | 4 | ||||
| -rw-r--r-- | src/elements/sprk.c | 2 | ||||
| -rw-r--r-- | src/elements/stkm.c | 2 |
8 files changed, 11 insertions, 11 deletions
diff --git a/src/elements/bcln.c b/src/elements/bcln.c index 053df18..63a2bbc 100644 --- a/src/elements/bcln.c +++ b/src/elements/bcln.c @@ -24,7 +24,7 @@ int update_BCLN(UPDATE_FUNC_ARGS) { parts[i].vx += advection*vx[y/CELL][x/CELL]; parts[i].vy += advection*vy[y/CELL][x/CELL]; } - if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) + if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || !ptypes[parts[i].ctype].enabled || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) { int r, rx, ry; for (rx=-1; rx<2; rx++) diff --git a/src/elements/clne.c b/src/elements/clne.c index e84252a..05834b0 100644 --- a/src/elements/clne.c +++ b/src/elements/clne.c @@ -16,7 +16,7 @@ #include <element.h> int update_CLNE(UPDATE_FUNC_ARGS) { - if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) + if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || !ptypes[parts[i].ctype].enabled || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) { int r, rx, ry; for (rx=-1; rx<2; rx++) diff --git a/src/elements/conv.c b/src/elements/conv.c index 9696d98..bdba369 100644 --- a/src/elements/conv.c +++ b/src/elements/conv.c @@ -17,7 +17,7 @@ int update_CONV(UPDATE_FUNC_ARGS) { int r, rx, ry; - if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) + if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || !ptypes[parts[i].ctype].enabled || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) { for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) @@ -39,7 +39,7 @@ int update_CONV(UPDATE_FUNC_ARGS) { } } } - else if(parts[i].ctype>0 && parts[i].ctype<PT_NUM && parts[i].ctype!=PT_CONV) { + else if(parts[i].ctype>0 && parts[i].ctype<PT_NUM && ptypes[parts[i].ctype].enabled && parts[i].ctype!=PT_CONV) { for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES) diff --git a/src/elements/neut.c b/src/elements/neut.c index 3e59335..5b8a4ae 100644 --- a/src/elements/neut.c +++ b/src/elements/neut.c @@ -26,7 +26,7 @@ int create_n_parts(int n, int x, int y, float vx, float vy, float temp, int t)// if (n>340) { n = 340; } - if (x<0 || y<0 || x>=XRES || y>=YRES || t<0 || t>=PT_NUM) + if (x<0 || y<0 || x>=XRES || y>=YRES || t<0 || t>=PT_NUM || !ptypes[t].enabled) return -1; for (c=0; c<n; c++) { diff --git a/src/elements/pbcn.c b/src/elements/pbcn.c index edb3f9f..2754a1a 100644 --- a/src/elements/pbcn.c +++ b/src/elements/pbcn.c @@ -32,7 +32,7 @@ int update_PBCN(UPDATE_FUNC_ARGS) { return 1; } } - if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) + if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || !ptypes[parts[i].ctype].enabled || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES) @@ -72,7 +72,7 @@ int update_PBCN(UPDATE_FUNC_ARGS) { } } } - if (parts[i].ctype>0 && parts[i].ctype<PT_NUM && parts[i].life==10) { + if (parts[i].ctype>0 && parts[i].ctype<PT_NUM && ptypes[parts[i].ctype].enabled && parts[i].life==10) { if (parts[i].ctype==PT_PHOT) {//create photons a different way for (rx=-1; rx<2; rx++) { for (ry=-1; ry<2; ry++) diff --git a/src/elements/pcln.c b/src/elements/pcln.c index 74412e0..30055e8 100644 --- a/src/elements/pcln.c +++ b/src/elements/pcln.c @@ -41,7 +41,7 @@ int update_PCLN(UPDATE_FUNC_ARGS) { parts[i].life = 10; } } - if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) + if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || !ptypes[parts[i].ctype].enabled || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES) @@ -62,7 +62,7 @@ int update_PCLN(UPDATE_FUNC_ARGS) { parts[i].tmp = parts[r>>8].ctype; } } - if (parts[i].ctype>0 && parts[i].ctype<PT_NUM && parts[i].life==10) { + if (parts[i].ctype>0 && parts[i].ctype<PT_NUM && ptypes[parts[i].ctype].enabled && parts[i].life==10) { if (parts[i].ctype==PT_PHOT) {//create photons a different way for (rx=-1; rx<2; rx++) { for (ry=-1; ry<2; ry++) diff --git a/src/elements/sprk.c b/src/elements/sprk.c index 4f95565..291937a 100644 --- a/src/elements/sprk.c +++ b/src/elements/sprk.c @@ -23,7 +23,7 @@ int update_SPRK(UPDATE_FUNC_ARGS) { { if (ct==PT_WATR||ct==PT_SLTW||ct==PT_PSCN||ct==PT_NSCN||ct==PT_ETRD||ct==PT_INWR) parts[i].temp = R_TEMP + 273.15f; - if (ct<=0 || ct>=PT_NUM) + if (ct<=0 || ct>=PT_NUM || !ptypes[ct].enabled) ct = PT_METL; part_change_type(i,x,y,ct); parts[i].ctype = PT_NONE; diff --git a/src/elements/stkm.c b/src/elements/stkm.c index a72f839..9271c54 100644 --- a/src/elements/stkm.c +++ b/src/elements/stkm.c @@ -54,7 +54,7 @@ int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) { float gvx, gvy; float gx, gy, dl, dr; - if ((parts[i].ctype>0 && parts[i].ctype<PT_NUM && ptypes[parts[i].ctype].falldown>0) || parts[i].ctype==SPC_AIR || parts[i].ctype == PT_NEUT || parts[i].ctype == PT_PHOT || parts[i].ctype == PT_LIGH) + if ((parts[i].ctype>0 && parts[i].ctype<PT_NUM && ptypes[parts[i].ctype].enabled && ptypes[parts[i].ctype].falldown>0) || parts[i].ctype==SPC_AIR || parts[i].ctype == PT_NEUT || parts[i].ctype == PT_PHOT || parts[i].ctype == PT_LIGH) playerp->elem = parts[i].ctype; playerp->frames++; |
