From b7dbb7782e5e1ca96ea3e79521f9ce0d7f5ab7f7 Mon Sep 17 00:00:00 2001 From: LJ Sonic <lamr@free.fr> Date: Wed, 12 Jan 2022 23:06:26 +0100 Subject: [PATCH] Only load map lumps that are WADs or have no extension --- src/p_setup.c | 2 +- src/w_wad.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 4f21922a0c..f6abc70e6a 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -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); diff --git a/src/w_wad.c b/src/w_wad.c index e49e0ce82f..b594912f1b 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -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; -- GitLab