- allow changing to the current map by using "*" as argument. Implemented for 'map', 'changemap' and 'recordmap'.

This commit is contained in:
Christoph Oelckers 2017-04-28 11:39:47 +02:00
parent 694b48423a
commit ec1aeaf384
2 changed files with 18 additions and 9 deletions

View file

@ -364,11 +364,14 @@ CCMD (changemap)
if (argv.argc() > 1) if (argv.argc() > 1)
{ {
const char *mapname = argv[1];
if (!strcmp(mapname, "*")) mapname = level.MapName.GetChars();
try try
{ {
if (!P_CheckMapData(argv[1])) if (!P_CheckMapData(mapname))
{ {
Printf ("No map %s\n", argv[1]); Printf ("No map %s\n", mapname);
} }
else else
{ {
@ -381,7 +384,7 @@ CCMD (changemap)
{ {
Net_WriteByte (DEM_CHANGEMAP); Net_WriteByte (DEM_CHANGEMAP);
} }
Net_WriteString (argv[1]); Net_WriteString (mapname);
} }
} }
catch(CRecoverableError &error) catch(CRecoverableError &error)

View file

@ -182,11 +182,14 @@ CCMD (map)
} }
if (argv.argc() > 1) if (argv.argc() > 1)
{ {
const char *mapname = argv[1];
if (!strcmp(mapname, "*")) mapname = level.MapName.GetChars();
try try
{ {
if (!P_CheckMapData(argv[1])) if (!P_CheckMapData(mapname))
{ {
Printf ("No map %s\n", argv[1]); Printf ("No map %s\n", mapname);
} }
else else
{ {
@ -200,7 +203,7 @@ CCMD (map)
deathmatch = true; deathmatch = true;
multiplayernext = true; multiplayernext = true;
} }
G_DeferedInitNew (argv[1]); G_DeferedInitNew (mapname);
} }
} }
catch(CRecoverableError &error) catch(CRecoverableError &error)
@ -229,11 +232,14 @@ CCMD(recordmap)
} }
if (argv.argc() > 2) if (argv.argc() > 2)
{ {
const char *mapname = argv[2];
if (!strcmp(mapname, "*")) mapname = level.MapName.GetChars();
try try
{ {
if (!P_CheckMapData(argv[2])) if (!P_CheckMapData(mapname))
{ {
Printf("No map %s\n", argv[2]); Printf("No map %s\n", mapname);
} }
else else
{ {
@ -247,7 +253,7 @@ CCMD(recordmap)
deathmatch = true; deathmatch = true;
multiplayernext = true; multiplayernext = true;
} }
G_DeferedInitNew(argv[2]); G_DeferedInitNew(mapname);
gameaction = ga_recordgame; gameaction = ga_recordgame;
newdemoname = argv[1]; newdemoname = argv[1];
newdemomap = argv[2]; newdemomap = argv[2];