]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
* don't expand cvars in comments
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 23 Jun 2009 19:11:15 +0000 (19:11 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 23 Jun 2009 19:11:15 +0000 (19:11 +0000)
* improve text definition of alias
* fix SDL cd loop bug

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9032 d7cf8633-e32d-0410-b094-e92efae38249

cd_sdl.c
cmd.c

index 66ab1b6fe0d8d6584a7fade808c0630bd16b9686..abb8cfbebf92cf9b60b62fc556f1addc3a6b80e8 100644 (file)
--- a/cd_sdl.c
+++ b/cd_sdl.c
@@ -70,7 +70,7 @@ void CDAudio_SysSetVolume (float volume)
 
 int CDAudio_SysPlay (int track)
 {
-       return SDL_CDPlayTracks(cd, track, 0, 1, 0);
+       return SDL_CDPlayTracks(cd, track-1, 0, 1, 0);
 }
 
 int CDAudio_SysStop (void)
diff --git a/cmd.c b/cmd.c
index fad9aa4d5b4a51991be26e8ca67aa074cac2d936..b684a0caefd4fb121e969163e8d768d49a834423 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -876,7 +876,7 @@ static const char *Cmd_GetCvarValue(const char *var, size_t varlen, cmdalias_t *
 /*
 Cmd_PreprocessString
 
-Preprocesses strings and replaces $*, $param#, $cvar accordingly
+Preprocesses strings and replaces $*, $param#, $cvar accordingly. Also strips comments.
 */
 static void Cmd_PreprocessString( const char *intext, char *outtext, unsigned maxoutlen, cmdalias_t *alias ) {
        const char *in;
@@ -983,9 +983,11 @@ static void Cmd_PreprocessString( const char *intext, char *outtext, unsigned ma
                                        --eat;
                                }
                        }
-               } else {
-                       outtext[outlen++] = *in++;
                }
+               else if( *in == '/' && *(in+1) == '/') // comment line starting
+                       break;
+               else 
+                       outtext[outlen++] = *in++;
        }
        outtext[outlen] = 0;
 }
@@ -1140,7 +1142,7 @@ void Cmd_Init_Commands (void)
        Cmd_AddCommand ("stuffcmds",Cmd_StuffCmds_f, "execute commandline parameters (must be present in quake.rc script)");
        Cmd_AddCommand ("exec",Cmd_Exec_f, "execute a script file");
        Cmd_AddCommand ("echo",Cmd_Echo_f, "print a message to the console (useful in scripts)");
-       Cmd_AddCommand ("alias",Cmd_Alias_f, "create a script function (parameters are passed in as $1 through $9, and $* for all parameters)");
+       Cmd_AddCommand ("alias",Cmd_Alias_f, "create a script function (parameters are passed in as $X (being X a number), $* for all parameters, $X- for all parameters starting from $X). Without arguments show the list of all alias");
        Cmd_AddCommand ("cmd", Cmd_ForwardToServer, "send a console commandline to the server (used by some mods)");
        Cmd_AddCommand ("wait", Cmd_Wait_f, "make script execution wait for next rendered frame");
        Cmd_AddCommand ("set", Cvar_Set_f, "create or change the value of a console variable");