mirror of
https://github.com/ZDoom/acc.git
synced 2025-01-31 03:10:34 +00:00
- Use case insensitive search when checking for existing script names, since they're case
insensitive in the engine. SVN r3366 (trunk)
This commit is contained in:
parent
c99a7cf35e
commit
c10009b525
3 changed files with 45 additions and 1 deletions
2
parse.c
2
parse.c
|
@ -560,7 +560,7 @@ static void OuterScript(void)
|
||||||
}
|
}
|
||||||
else if(tk_Token == TK_STRING)
|
else if(tk_Token == TK_STRING)
|
||||||
{ // Named scripts start counting at -1 and go down from there.
|
{ // Named scripts start counting at -1 and go down from there.
|
||||||
scriptNumber = -1 - STR_FindInList(STRLIST_NAMEDSCRIPTS, tk_String);
|
scriptNumber = -1 - STR_FindInListInsensitive(STRLIST_NAMEDSCRIPTS, tk_String);
|
||||||
TK_NextToken();
|
TK_NextToken();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
43
strlist.c
43
strlist.c
|
@ -17,6 +17,10 @@
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define strcasecmp stricmp
|
||||||
|
#endif
|
||||||
|
|
||||||
// TYPES -------------------------------------------------------------------
|
// TYPES -------------------------------------------------------------------
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -45,6 +49,7 @@ typedef struct
|
||||||
|
|
||||||
static int STR_PutStringInSomeList(stringList_t *list, int index, char *name);
|
static int STR_PutStringInSomeList(stringList_t *list, int index, char *name);
|
||||||
static int STR_FindInSomeList(stringList_t *list, char *name);
|
static int STR_FindInSomeList(stringList_t *list, char *name);
|
||||||
|
static int STR_FindInSomeListInsensitive(stringList_t *list, char *name);
|
||||||
static void DumpStrings(stringList_t *list, int lenadr, boolean quad, boolean crypt);
|
static void DumpStrings(stringList_t *list, int lenadr, boolean quad, boolean crypt);
|
||||||
static void Encrypt(void *data, int key, int len);
|
static void Encrypt(void *data, int key, int len);
|
||||||
|
|
||||||
|
@ -175,6 +180,44 @@ static int STR_FindInSomeList(stringList_t *list, char *name)
|
||||||
return STR_PutStringInSomeList(list, i, name);
|
return STR_PutStringInSomeList(list, i, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// STR_FindInListInsensitive
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
int STR_FindInListInsensitive(int list, char *name)
|
||||||
|
{
|
||||||
|
if (StringLists[list] == NULL)
|
||||||
|
{
|
||||||
|
StringLists[list] = MS_Alloc(sizeof(stringList_t), ERR_OUT_OF_MEMORY);
|
||||||
|
StringLists[list]->stringCount = 0;
|
||||||
|
NumStringLists++;
|
||||||
|
}
|
||||||
|
return STR_FindInSomeListInsensitive (StringLists[list], name);
|
||||||
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// STR_FindInSomeListInsensitive
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
static int STR_FindInSomeListInsensitive(stringList_t *list, char *name)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for(i = 0; i < list->stringCount; i++)
|
||||||
|
{
|
||||||
|
if(strcasecmp(list->strings[i].name, name) == 0)
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Add to list
|
||||||
|
return STR_PutStringInSomeList(list, i, name);
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// STR_GetString
|
// STR_GetString
|
||||||
|
|
|
@ -25,6 +25,7 @@ void STR_WriteList(void);
|
||||||
int STR_FindLanguage(char *name);
|
int STR_FindLanguage(char *name);
|
||||||
int STR_FindInLanguage(int language, char *name);
|
int STR_FindInLanguage(int language, char *name);
|
||||||
int STR_FindInList(int list, char *name);
|
int STR_FindInList(int list, char *name);
|
||||||
|
int STR_FindInListInsensitive(int list, char *name);
|
||||||
int STR_AppendToList(int list, char *name);
|
int STR_AppendToList(int list, char *name);
|
||||||
const char *STR_GetString(int list, int index);
|
const char *STR_GetString(int list, int index);
|
||||||
void STR_WriteChunk(int language, boolean encrypt);
|
void STR_WriteChunk(int language, boolean encrypt);
|
||||||
|
|
Loading…
Reference in a new issue