mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'case-insensitive-wads' into 'master'
Fix instances of lump searching not being case insensitive See merge request KartKrew/Kart!783
This commit is contained in:
commit
a27e14ff21
1 changed files with 6 additions and 16 deletions
22
src/w_wad.c
22
src/w_wad.c
|
|
@ -1070,16 +1070,11 @@ UINT16 W_CheckNumForMapPwad(const char *name, UINT32 hash, UINT16 wad, UINT16 st
|
|||
UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump)
|
||||
{
|
||||
UINT16 i;
|
||||
static char uname[8 + 1];
|
||||
UINT32 hash;
|
||||
UINT32 hash = quickncasehash(name, 8);
|
||||
|
||||
if (!TestValidLump(wad,0))
|
||||
return INT16_MAX;
|
||||
|
||||
strlcpy(uname, name, sizeof uname);
|
||||
strupr(uname);
|
||||
hash = quickncasehash(uname, 8);
|
||||
|
||||
//
|
||||
// scan forward
|
||||
// start at 'startlump', useful parameter when there are multiple
|
||||
|
|
@ -1092,7 +1087,7 @@ UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump)
|
|||
{
|
||||
if (lump_p->hash != hash)
|
||||
continue;
|
||||
if (strncmp(lump_p->name, uname, sizeof(uname) - 1))
|
||||
if (strncasecmp(lump_p->name, name, 8))
|
||||
continue;
|
||||
return i;
|
||||
}
|
||||
|
|
@ -1111,16 +1106,11 @@ UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump)
|
|||
UINT16 W_CheckNumForLongNamePwad(const char *name, UINT16 wad, UINT16 startlump)
|
||||
{
|
||||
UINT16 i;
|
||||
static char uname[256 + 1];
|
||||
UINT32 hash;
|
||||
UINT32 hash = quickncasehash(name, 8); // Not a mistake, legacy system for short lumpnames
|
||||
|
||||
if (!TestValidLump(wad,0))
|
||||
return INT16_MAX;
|
||||
|
||||
strlcpy(uname, name, sizeof uname);
|
||||
strupr(uname);
|
||||
hash = quickncasehash(uname, 8); // Not a mistake, legacy system for short lumpnames
|
||||
|
||||
//
|
||||
// scan forward
|
||||
// start at 'startlump', useful parameter when there are multiple
|
||||
|
|
@ -1133,7 +1123,7 @@ UINT16 W_CheckNumForLongNamePwad(const char *name, UINT16 wad, UINT16 startlump)
|
|||
{
|
||||
if (lump_p->hash != hash)
|
||||
continue;
|
||||
if (strcmp(lump_p->longname, uname))
|
||||
if (strcasecmp(lump_p->longname, name))
|
||||
continue;
|
||||
return i;
|
||||
}
|
||||
|
|
@ -1227,7 +1217,7 @@ lumpnum_t W_CheckNumForName(const char *name)
|
|||
{
|
||||
if (!lumpnumcache[i & (LUMPNUMCACHESIZE - 1)].lumpname[8]
|
||||
&& lumpnumcache[i & (LUMPNUMCACHESIZE - 1)].lumphash == hash
|
||||
&& strncmp(lumpnumcache[i & (LUMPNUMCACHESIZE - 1)].lumpname, name, 8) == 0)
|
||||
&& strncasecmp(lumpnumcache[i & (LUMPNUMCACHESIZE - 1)].lumpname, name, 8) == 0)
|
||||
{
|
||||
lumpnumcacheindex = i & (LUMPNUMCACHESIZE - 1);
|
||||
return lumpnumcache[lumpnumcacheindex].lumpnum;
|
||||
|
|
@ -1282,7 +1272,7 @@ lumpnum_t W_CheckNumForLongName(const char *name)
|
|||
for (i = lumpnumcacheindex + LUMPNUMCACHESIZE; i > lumpnumcacheindex; i--)
|
||||
{
|
||||
if (lumpnumcache[i & (LUMPNUMCACHESIZE - 1)].lumphash == hash
|
||||
&& strcmp(lumpnumcache[i & (LUMPNUMCACHESIZE - 1)].lumpname, name) == 0)
|
||||
&& strcasecmp(lumpnumcache[i & (LUMPNUMCACHESIZE - 1)].lumpname, name) == 0)
|
||||
{
|
||||
lumpnumcacheindex = i & (LUMPNUMCACHESIZE - 1);
|
||||
return lumpnumcache[lumpnumcacheindex].lumpnum;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue