[quake3-commits] r2359 - trunk/code/client

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Nov 18 18:16:14 EST 2012


Author: ztm
Date: 2012-11-18 18:16:13 -0500 (Sun, 18 Nov 2012)
New Revision: 2359

Modified:
   trunk/code/client/snd_main.c
Log:
Improve "play" command, based on a patch from Ensiform.

Modified: trunk/code/client/snd_main.c
===================================================================
--- trunk/code/client/snd_main.c	2012-11-18 22:24:15 UTC (rev 2358)
+++ trunk/code/client/snd_main.c	2012-11-18 23:16:13 UTC (rev 2359)
@@ -400,22 +400,28 @@
 */
 void S_Play_f( void ) {
 	int 		i;
+	int			c;
 	sfxHandle_t	h;
-	char		name[256];
+	char		name[MAX_TOKEN_CHARS];
 
 	if( !si.RegisterSound || !si.StartLocalSound ) {
 		return;
 	}
 
-	i = 1;
-	while ( i<Cmd_Argc() ) {
+	c = Cmd_Argc();
+
+	if( c < 2 ) {
+		Com_Printf ("Usage: play <sound filename> [sound filename] [sound filename] ...\n");
+		return;
+	}
+
+	for( i = 1; i < c; i++ ) {
 		Q_strncpyz( name, Cmd_Argv(i), sizeof(name) );
 		h = si.RegisterSound( name, qfalse );
 
 		if( h ) {
 			si.StartLocalSound( h, CHAN_LOCAL_SOUND );
 		}
-		i++;
 	}
 }
 
@@ -438,7 +444,7 @@
 	} else if ( c == 3 ) {
 		si.StartBackgroundTrack( Cmd_Argv(1), Cmd_Argv(2) );
 	} else {
-		Com_Printf ("music <musicfile> [loopfile]\n");
+		Com_Printf ("Usage: music <musicfile> [loopfile]\n");
 		return;
 	}
 



More information about the quake3-commits mailing list