summaryrefslogtreecommitdiff
path: root/src/elements/pcln.c
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2011-06-24 21:55:59 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-06-25 14:59:30 (GMT)
commit34d76f86803138699b46f7e6252c11985ef481cf (patch)
tree99c962bea2e407f70a20b1d69f1c453f2abfc04c /src/elements/pcln.c
parentc18009dd9c87343178e808565d815b454bd2b585 (diff)
downloadpowder-34d76f86803138699b46f7e6252c11985ef481cf.zip
powder-34d76f86803138699b46f7e6252c11985ef481cf.tar.gz
Check photon map in Lua functions, and allow any ctype
Also add some extra checks on ctype in the rest of the game
Diffstat (limited to 'src/elements/pcln.c')
-rw-r--r--src/elements/pcln.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/elements/pcln.c b/src/elements/pcln.c
index 8afa656..3ba431c 100644
--- a/src/elements/pcln.c
+++ b/src/elements/pcln.c
@@ -26,7 +26,7 @@ int update_PCLN(UPDATE_FUNC_ARGS) {
parts[i].life = 10;
}
}
- if (!parts[i].ctype)
+ if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM)
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)
@@ -43,7 +43,7 @@ int update_PCLN(UPDATE_FUNC_ARGS) {
(r&0xFF)<PT_NUM)
parts[i].ctype = r&0xFF;
}
- if (parts[i].ctype && parts[i].life==10) {
+ if (parts[i].ctype>0 && parts[i].ctype<PT_NUM && 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++) {