Merge branch 'mapcommand' into 'next'

Add shortcuts for current/next map to map command

See merge request STJr/SRB2!2169
This commit is contained in:
sphere 2023-12-22 10:54:01 +00:00
commit 37ecb6b48e

View file

@ -5380,16 +5380,27 @@ void G_FreeMapSearch(mapsearchfreq_t *freq, INT32 freqc)
INT32 G_FindMapByNameOrCode(const char *mapname, char **realmapnamep)
{
boolean usemapcode = false;
INT32 newmapnum;
size_t mapnamelen;
size_t mapnamelen = strlen(mapname);
char *p;
mapnamelen = strlen(mapname);
if (mapnamelen == 2)/* maybe two digit code */
if (mapnamelen == 1)
{
if (mapname[0] == '*') // current map
return gamemap;
else if (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]) ))
usemapcode = true;