From 68c4d6d6214979b4a99caff2a0d4e6f543790c3e Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sat, 14 May 2011 21:46:04 +0800 Subject: [PATCH] Make sure WIND can't be created Revert this if the element number is reused for something useful --- src/console.c | 5 +++++ src/powder.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/console.c b/src/console.c index e926328bf..26a072300 100644 --- a/src/console.c +++ b/src/console.c @@ -11,6 +11,11 @@ int file_script = 0; int console_parse_type(char *txt, int *element, char *err) { int i = -1; + if (strcasecmp(txt,"WIND")==0) + { + 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; diff --git a/src/powder.c b/src/powder.c index 5c3a6d9f5..3f5898e7a 100644 --- a/src/powder.c +++ b/src/powder.c @@ -568,6 +568,8 @@ 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) + t = PT_NONE; parts[i].type = t; if (t==PT_PHOT || t==PT_NEUT) { @@ -593,6 +595,8 @@ inline int create_part(int p, int x, int y, int t)//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) + return -1; if (t==SPC_HEAT||t==SPC_COOL) {