Fix replacing MAPXX maps through adding a WAD not working

This commit is contained in:
Lactozilla 2024-06-18 23:59:18 -03:00
parent 7558589a2a
commit aaae5ae941

View file

@ -8199,7 +8199,6 @@ void P_LoadMapsFromFile(UINT16 wadnum, boolean added_ingame)
lumpinfo_t *lumpinfo = NULL;
UINT16 numlumps = 0;
INT16 num;
const char *name;
if (W_FileHasFolders(wadfiles[wadnum]))
@ -8245,20 +8244,18 @@ void P_LoadMapsFromFile(UINT16 wadnum, boolean added_ingame)
for (size_t i = 0; i < numlumps; i++, lumpinfo++)
{
name = lumpinfo->name;
if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P')
if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P' && name[5] == '\0')
{
int status = P_AddMap(name, (wadnum << 16) + i);
if (status == 1)
{
if (name[5]!='\0')
continue;
num = (INT16)M_MapNumber(name[3], name[4]);
//If you replaced the map you're on, end the level when done.
if (gamestate == GS_LEVEL && num == gamemap)
replacedcurrentmap = true;
if (added_ingame)
CONS_Printf("%s\n", name);
mapsadded = true;
}
else if (status < 0)
break;
}
}
// Now do markers