Add shortcuts for current/next map to map command

This commit is contained in:
spherallic 2023-06-14 13:15:05 +02:00
parent 9925e96365
commit d2996a308c

View file

@ -5373,16 +5373,27 @@ void G_FreeMapSearch(mapsearchfreq_t *freq, INT32 freqc)
INT32 G_FindMapByNameOrCode(const char *mapname, char **realmapnamep) INT32 G_FindMapByNameOrCode(const char *mapname, char **realmapnamep)
{ {
boolean usemapcode = false; boolean usemapcode = false;
INT32 newmapnum; INT32 newmapnum;
size_t mapnamelen = strlen(mapname);
size_t mapnamelen;
char *p; char *p;
mapnamelen = strlen(mapname); if (mapnamelen == 1)
{
if (mapnamelen == 2)/* maybe two digit code */ if (strcmp(mapname, "*") == 0) // current map
return gamemap;
else if (strcmp(mapname, "+") == 0 && mapheaderinfo[gamemap-1]) // next map
{
newmapnum = mapheaderinfo[gamemap-1]->nextlevel;
if (newmapnum < 1 || newmapnum > NUMMAPS)
{
CONS_Alert(CONS_ERROR, M_GetText("NextLevel (%d) is not a valid map.\n"), newmapnum);
return 0;
}
else
return newmapnum;
}
}
else if (mapnamelen == 2)/* maybe two digit code */
{ {
if (( newmapnum = M_MapNumber(mapname[0], mapname[1]) )) if (( newmapnum = M_MapNumber(mapname[0], mapname[1]) ))
usemapcode = true; usemapcode = true;