]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
changed strzone, stuffcmd, and localcmd to be able to take multiple strings
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 25 Nov 2005 06:55:40 +0000 (06:55 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 25 Nov 2005 06:55:40 +0000 (06:55 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5833 d7cf8633-e32d-0410-b094-e92efae38249

pr_cmds.c
prvm_cmds.c
svvm_cmds.c

index 0e84047bedf74446995cfb9a34e4bfa2daf5003a..f3610414df0860b8e6fe9af3b064c277a2705798 100644 (file)
--- a/pr_cmds.c
+++ b/pr_cmds.c
@@ -956,14 +956,14 @@ PF_stuffcmd
 
 Sends text over to the client's execution buffer
 
-stuffcmd (clientent, value)
+stuffcmd (clientent, value, ...)
 =================
 */
 void PF_stuffcmd (void)
 {
        int             entnum;
-       const char      *str;
        client_t        *old;
+       char string[VM_STRINGTEMP_LENGTH];
 
        entnum = PRVM_G_EDICTNUM(OFS_PARM0);
        if (entnum < 1 || entnum > svs.maxclients || !svs.clients[entnum-1].active)
@@ -971,11 +971,11 @@ void PF_stuffcmd (void)
                Con_Print("Can't stuffcmd to a non-client\n");
                return;
        }
-       str = PRVM_G_STRING(OFS_PARM1);
+       VM_VarString(1, string, sizeof(string));
 
        old = host_client;
        host_client = svs.clients + entnum-1;
-       Host_ClientCommands ("%s", str);
+       Host_ClientCommands ("%s", string);
        host_client = old;
 }
 
@@ -985,12 +985,14 @@ PF_localcmd
 
 Sends text to server console
 
-localcmd (string)
+localcmd (string, ...)
 =================
 */
 void PF_localcmd (void)
 {
-       Cbuf_AddText(PRVM_G_STRING(OFS_PARM0));
+       char string[VM_STRINGTEMP_LENGTH];
+       VM_VarString(0, string, sizeof(string));
+       Cbuf_AddText(string);
 }
 
 /*
index e82fa7f7442fee53c955fbf01d5c8dcc029c6e1c..c0cc2c2a6630cef9848eda058a59efca6fa20e4a 100644 (file)
@@ -466,15 +466,16 @@ VM_localcmd
 
 Sends text over to the client's execution buffer
 
-[localcmd (string) or]
-cmd (string)
+[localcmd (string, ...) or]
+cmd (string, ...)
 =================
 */
 void VM_localcmd (void)
 {
+       char string[VM_STRINGTEMP_LENGTH];
        VM_SAFEPARMCOUNT(1,VM_localcmd);
-
-       Cbuf_AddText(PRVM_G_STRING(OFS_PARM0));
+       VM_VarString(0, string, sizeof(string));
+       Cbuf_AddText(string);
 }
 
 /*
@@ -1786,17 +1787,17 @@ VM_strzone
 string strzone(string s)
 =========
 */
-//string(string s) strzone = #118; // makes a copy of a string into the string zone and returns it, this is often used to keep around a tempstring for longer periods of time (tempstrings are replaced often)
+//string(string s, ...) strzone = #118; // makes a copy of a string into the string zone and returns it, this is often used to keep around a tempstring for longer periods of time (tempstrings are replaced often)
 void VM_strzone(void)
 {
-       const char *in;
        char *out;
+       char string[VM_STRINGTEMP_LENGTH];
 
        VM_SAFEPARMCOUNT(1,VM_strzone);
 
-       in = PRVM_G_STRING(OFS_PARM0);
-       PRVM_G_INT(OFS_RETURN) = PRVM_AllocString(strlen(in) + 1, &out);
-       strcpy(out, in);
+       VM_VarString(0, string, sizeof(string));
+       PRVM_G_INT(OFS_RETURN) = PRVM_AllocString(strlen(string) + 1, &out);
+       strcpy(out, string);
 }
 
 /*
index 89b03104523a0b2f068c5b38f780fc49ec938ac5..e096554524ed8389a361c93dea4a7fdcd6be73a9 100644 (file)
@@ -653,14 +653,14 @@ PF_stuffcmd
 
 Sends text over to the client's execution buffer
 
-stuffcmd (clientent, value)
+stuffcmd (clientent, value, ...)
 =================
 */
 void PF_stuffcmd (void)
 {
        int             entnum;
-       const char      *str;
        client_t        *old;
+       char    string[VM_STRINGTEMP_LENGTH];
 
        entnum = PRVM_G_EDICTNUM(OFS_PARM0);
        if (entnum < 1 || entnum > svs.maxclients || !svs.clients[entnum-1].active)
@@ -668,11 +668,12 @@ void PF_stuffcmd (void)
                Con_Print("Can't stuffcmd to a non-client\n");
                return;
        }
-       str = PRVM_G_STRING(OFS_PARM1);
+
+       VM_VarString(1, string, sizeof(string));
 
        old = host_client;
        host_client = svs.clients + entnum-1;
-       Host_ClientCommands ("%s", str);
+       Host_ClientCommands ("%s", string);
        host_client = old;
 }