Merge branch 'ignore-bad-map-lumps' into 'next'

Only load map lumps that are WADs or have no extension

See merge request STJr/SRB2!1715
This commit is contained in:
LJ Sonic 2022-02-06 17:12:07 +00:00
commit 9d993a585f
2 changed files with 9 additions and 3 deletions

View file

@ -4373,7 +4373,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
// internal game map
maplumpname = G_BuildMapName(gamemap);
lastloadedmaplumpnum = W_CheckNumForName(maplumpname);
lastloadedmaplumpnum = W_CheckNumForMap(maplumpname);
if (lastloadedmaplumpnum == LUMPERROR)
I_Error("Map %s not found.\n", maplumpname);

View file

@ -1463,8 +1463,14 @@ lumpnum_t W_CheckNumForMap(const char *name)
continue;
// Now look for the specified map.
for (; lumpNum < end; lumpNum++)
if (!strnicmp(name, (wadfiles[i]->lumpinfo + lumpNum)->name, 8))
return (i<<16) + lumpNum;
{
if (!strnicmp(name, wadfiles[i]->lumpinfo[lumpNum].name, 8))
{
const char *extension = strrchr(wadfiles[i]->lumpinfo[lumpNum].fullname, '.');
if (!(extension && stricmp(extension, ".wad")))
return (i<<16) + lumpNum;
}
}
}
}
return LUMPERROR;