diff options
| author | jacksonmj <mj-pt@jacksonmj.co.uk> | 2011-07-22 19:33:36 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-07-24 12:07:15 (GMT) |
| commit | 7ed0255f04f494e914b724cf5614f4f1d343069a (patch) | |
| tree | 2949a549d709088a977905abd2f71c6193dec250 /src | |
| parent | ae9fca86ee7dd1ea2a781dee6f2f4727ac094e2b (diff) | |
| download | powder-7ed0255f04f494e914b724cf5614f4f1d343069a.zip powder-7ed0255f04f494e914b724cf5614f4f1d343069a.tar.gz | |
Disable old life elements
Diffstat (limited to 'src')
| -rw-r--r-- | src/console.c | 9 | ||||
| -rw-r--r-- | src/luaconsole.c | 4 | ||||
| -rw-r--r-- | src/main.c | 2 | ||||
| -rw-r--r-- | src/powder.c | 4 |
4 files changed, 7 insertions, 12 deletions
diff --git a/src/console.c b/src/console.c index e4551d0..f6ddeb7 100644 --- a/src/console.c +++ b/src/console.c @@ -12,23 +12,18 @@ int file_script = 0; int console_parse_type(char *txt, int *element, char *err) { int i = -1; - if (strcasecmp(txt,"WIND")==0) - { - if (err) strcpy(err, "Particle type not recognised"); - return 0; - } // alternative names for some elements if (strcasecmp(txt,"C4")==0) i = PT_PLEX; else if (strcasecmp(txt,"C5")==0) i = PT_C5; else if (strcasecmp(txt,"NONE")==0) i = PT_NONE; - if (i>=0) + if (i>=0 && i<PT_NUM && ptypes[i].enabled) { *element = i; if (err) strcpy(err,""); return 1; } for (i=1; i<PT_NUM; i++) { - if (strcasecmp(txt,ptypes[i].name)==0) + if (strcasecmp(txt,ptypes[i].name)==0 && ptypes[i].enabled) { *element = i; if (err) strcpy(err,""); diff --git a/src/luaconsole.c b/src/luaconsole.c index 6b91ee8..c854d67 100644 --- a/src/luaconsole.c +++ b/src/luaconsole.c @@ -175,9 +175,7 @@ int luatpt_create(lua_State* l) if(x < XRES && y < YRES){ if(lua_isnumber(l, 3)){ t = luaL_optint(l, 3, 0); - if (t==OLD_PT_WIND) - return 0; - if (t<0 || t >= PT_NUM) + if (t<0 || t >= PT_NUM || !ptypes[t].enabled) return luaL_error(l, "Unrecognised element number '%d'", t); } else { name = luaL_optstring(l, 3, "dust"); @@ -1009,6 +1009,8 @@ int parse_save(void *save, int size, int replace, int x0, int y0, unsigned char } ty = PT_LIFE; } + if (!ptypes[parts[i-1].type].enabled) + parts[i-1].type = PT_NONE; } } diff --git a/src/powder.c b/src/powder.c index 90438f8..6167abf 100644 --- a/src/powder.c +++ b/src/powder.c @@ -616,7 +616,7 @@ inline void part_change_type(int i, int x, int y, int t)//changes the type of pa { if (x<0 || y<0 || x>=XRES || y>=YRES || i>=NPART || t<0 || t>=PT_NUM) return; - if (t==OLD_PT_WIND) + if (!ptypes[t].enabled) t = PT_NONE; parts[i].type = t; if (t==PT_PHOT || t==PT_NEUT) @@ -646,7 +646,7 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a if (x<0 || y<0 || x>=XRES || y>=YRES || ((t<0 || t>=PT_NUM)&&t!=SPC_HEAT&&t!=SPC_COOL&&t!=SPC_AIR&&t!=SPC_VACUUM)) return -1; - if (t==OLD_PT_WIND) + if (t>=0 && t<PT_NUM && !ptypes[t].enabled) return -1; if (t==SPC_HEAT||t==SPC_COOL) |
