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