Make "playdemo" without args replay the last demo.

This commit is contained in:
Bill Currie 2012-06-29 18:44:42 +09:00
parent 7eaa6b72d6
commit cf48d5ab04
2 changed files with 15 additions and 2 deletions

View File

@ -498,6 +498,10 @@ CL_PlayDemo_f (void)
return;
switch (Cmd_Argc ()) {
case 1:
if (!demoname[0])
goto playdemo_error;
// fall through
case 2:
cls.demo_capture = 0;
break;
@ -508,11 +512,14 @@ CL_PlayDemo_f (void)
}
// fall through
default:
playdemo_error:
Sys_Printf ("play <demoname> : plays a demo\n");
return;
}
timedemo_runs = timedemo_count = 1; // make sure looped timedemos stop
strncpy (demoname, Cmd_Argv (1), sizeof (demoname));
if (Cmd_Argc () > 1)
strncpy (demoname, Cmd_Argv (1), sizeof (demoname));
CL_StartDemo ();
}

View File

@ -1051,6 +1051,10 @@ static void
CL_PlayDemo_f (void)
{
switch (Cmd_Argc ()) {
case 1:
if (!demoname[0])
goto playdemo_error;
// fall through
case 2:
cls.demo_capture = 0;
break;
@ -1061,6 +1065,7 @@ CL_PlayDemo_f (void)
}
// fall through
default:
playdemo_error:
Sys_Printf ("play <demoname> : plays a demo\n");
return;
}
@ -1068,7 +1073,8 @@ CL_PlayDemo_f (void)
// disconnect from server
CL_Disconnect ();
strncpy (demoname, Cmd_Argv (1), sizeof (demoname));
if (Cmd_Argc () > 1)
strncpy (demoname, Cmd_Argv (1), sizeof (demoname));
CL_StartDemo ();
}