mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-21 08:51:10 +00:00
Add shortcuts for current/next map to map command
This commit is contained in:
parent
9925e96365
commit
d2996a308c
1 changed files with 18 additions and 7 deletions
25
src/g_game.c
25
src/g_game.c
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue