]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - pr_cmds.c
changed strzone, stuffcmd, and localcmd to be able to take multiple strings
[xonotic/darkplaces.git] / pr_cmds.c
index cc5c4141acfe57fa39e10ce77e7e1182e7830a16..f3610414df0860b8e6fe9af3b064c277a2705798 100644 (file)
--- a/pr_cmds.c
+++ b/pr_cmds.c
@@ -25,7 +25,7 @@ cvar_t pr_zone_min_strings = {0, "pr_zone_min_strings", "64"};
 
 // LordHavoc: added this to semi-fix the problem of using many ftos calls in a print
 #define STRINGTEMP_BUFFERS 16
-#define STRINGTEMP_LENGTH 4096
+#define STRINGTEMP_LENGTH MAX_INPUTLINE
 static char pr_string_temp[STRINGTEMP_BUFFERS][STRINGTEMP_LENGTH];
 static int pr_string_tempindex = 0;
 
@@ -316,7 +316,7 @@ void SetMinMaxSize (prvm_edict_t *e, float *min, float *max, qboolean rotate)
 
        for (i=0 ; i<3 ; i++)
                if (min[i] > max[i])
-                       PF_ERROR("SetMinMaxSize: backwards mins/maxs\n");
+                       PF_ERROR("SetMinMaxSize: backwards mins/maxs");
 
 // set derived values
        VectorCopy (min, e->fields.server->mins);
@@ -717,7 +717,7 @@ break()
 */
 void PF_break (void)
 {
-       PF_ERROR("break: break statement\n");
+       PF_ERROR("break: break statement");
 }
 
 /*
@@ -855,7 +855,7 @@ void PF_checkpos (void)
 //============================================================================
 
 int checkpvsbytes;
-qbyte checkpvs[MAX_MAP_LEAFS/8];
+unsigned char checkpvs[MAX_MAP_LEAFS/8];
 
 int PF_newcheckclient (int check)
 {
@@ -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);
 }
 
 /*
@@ -1808,7 +1810,7 @@ sizebuf_t *WriteDest (void)
                ent = PRVM_PROG_TO_EDICT(prog->globals.server->msg_entity);
                entnum = PRVM_NUM_FOR_EDICT(ent);
                if (entnum < 1 || entnum > svs.maxclients || !svs.clients[entnum-1].active)
-                       Host_Error("WriteDest: tried to write to non-client\n");
+                       Host_Error("WriteDest: tried to write to non-client");
                return &svs.clients[entnum-1].message;
 
        case MSG_ALL:
@@ -3027,7 +3029,7 @@ void PF_clientcommand (void)
 //this function originally written by KrimZon, made shorter by LordHavoc
 //20040203: rewritten by LordHavoc (no longer uses allocations)
 int num_tokens = 0;
-char *tokens[256], tokenbuf[4096];
+char *tokens[256], tokenbuf[MAX_INPUTLINE];
 void PF_tokenize (void)
 {
        int pos;