Fix realmapnamep not being set with map * and +

This commit is contained in:
spherallic 2023-12-22 14:23:24 +01:00
parent 37ecb6b48e
commit 7893d08407

View file

@ -5387,17 +5387,19 @@ INT32 G_FindMapByNameOrCode(const char *mapname, char **realmapnamep)
if (mapnamelen == 1) if (mapnamelen == 1)
{ {
if (mapname[0] == '*') // current map if (mapname[0] == '*') // current map
return gamemap; {
usemapcode = true;
newmapnum = gamemap;
}
else if (mapname[0] == '+' && mapheaderinfo[gamemap-1]) // next map else if (mapname[0] == '+' && mapheaderinfo[gamemap-1]) // next map
{ {
usemapcode = true;
newmapnum = mapheaderinfo[gamemap-1]->nextlevel; newmapnum = mapheaderinfo[gamemap-1]->nextlevel;
if (newmapnum < 1 || newmapnum > NUMMAPS) if (newmapnum < 1 || newmapnum > NUMMAPS)
{ {
CONS_Alert(CONS_ERROR, M_GetText("NextLevel (%d) is not a valid map.\n"), newmapnum); CONS_Alert(CONS_ERROR, M_GetText("NextLevel (%d) is not a valid map.\n"), newmapnum);
return 0; return 0;
} }
else
return newmapnum;
} }
} }
else if (mapnamelen == 2)/* maybe two digit code */ else if (mapnamelen == 2)/* maybe two digit code */