- Do not allow scripts to be named "None".

SVN r3391 (trunk)
This commit is contained in:
Randy Heit 2012-02-26 02:37:44 +00:00
parent 2c34cdee72
commit 14c7636374
5 changed files with 11 additions and 5 deletions

View file

@ -177,6 +177,7 @@ static struct
{ ERR_UNCLOSED_WITH_ARGS, "Most special scripts must not have arguments." },
{ ERR_NOT_A_CHAR_ARRAY, "%s has %d dimensions. Use %d subscripts to get a char array." },
{ ERR_CANT_FIND_INCLUDE, "Couldn't find include file \"%s\"." },
{ ERR_SCRIPT_NAMED_NONE, "Scripts may not be named \"None\"." },
{ ERR_NONE, NULL }
};

View file

@ -144,7 +144,8 @@ typedef enum
ERR_DISCONNECT_NEEDS_1_ARG,
ERR_UNCLOSED_WITH_ARGS,
ERR_NOT_A_CHAR_ARRAY,
ERR_CANT_FIND_INCLUDE
ERR_CANT_FIND_INCLUDE,
ERR_SCRIPT_NAMED_NONE,
} error_t;
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------

4
misc.h
View file

@ -15,6 +15,10 @@
// MACROS ------------------------------------------------------------------
#ifdef _WIN32
#define strcasecmp stricmp
#endif
// TYPES -------------------------------------------------------------------
typedef enum

View file

@ -560,6 +560,10 @@ static void OuterScript(void)
}
else if(tk_Token == TK_STRING)
{ // Named scripts start counting at -1 and go down from there.
if(strcasecmp("None", tk_String) == 0)
{
ERR_Error(ERR_SCRIPT_NAMED_NONE, YES, NULL);
}
scriptNumber = -1 - STR_FindInListInsensitive(STRLIST_NAMEDSCRIPTS, tk_String);
TK_NextToken();
}

View file

@ -17,10 +17,6 @@
// MACROS ------------------------------------------------------------------
#ifdef _WIN32
#define strcasecmp stricmp
#endif
// TYPES -------------------------------------------------------------------
typedef struct