add an argument to filter out a cvar prefix
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 23 Jan 2009 10:32:27 +0000 (10:32 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 23 Jan 2009 10:32:27 +0000 (10:32 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8664 d7cf8633-e32d-0410-b094-e92efae38249

clvm_cmds.c
mvm_cmds.c
prvm_cmds.c
svvm_cmds.c

index beb7db2..82ce9fb 100644 (file)
@@ -3547,7 +3547,7 @@ VM_uri_get,                                               // #513 float(string uril, float id) uri_get = #512; (DP_QC_URI
 VM_tokenize_console,                                   // #514 float(string str) tokenize_console = #514; (DP_QC_TOKENIZE_CONSOLE)
 VM_argv_start_index,                                   // #515 float(float idx) argv_start_index = #515; (DP_QC_TOKENIZE_CONSOLE)
 VM_argv_end_index,                                             // #516 float(float idx) argv_end_index = #516; (DP_QC_TOKENIZE_CONSOLE)
-VM_buf_cvarlist,                                               // #517 void(float buf, string prefix) buf_cvarlist = #517; (DP_QC_STRINGBUFFERS_CVARLIST)
+VM_buf_cvarlist,                                               // #517 void(float buf, string prefix, string antiprefix) buf_cvarlist = #517; (DP_QC_STRINGBUFFERS_CVARLIST)
 VM_cvar_description,                                   // #518 float(string name) cvar_description = #518; (DP_QC_CVAR_DESCRIPTION)
 NULL,                                                  // #519
 VM_keynumtostring,                             // #520 string keynumtostring(float keynum)
index af39e50..69ed427 100644 (file)
@@ -1338,7 +1338,7 @@ VM_uri_get,                                               // #513 float(string uril, float id) uri_get = #513; (DP_QC_URI
 VM_tokenize_console,                                   // #514 float(string str) tokenize_console = #514; (DP_QC_TOKENIZE_CONSOLE)
 VM_argv_start_index,                                   // #515 float(float idx) argv_start_index = #515; (DP_QC_TOKENIZE_CONSOLE)
 VM_argv_end_index,                                             // #516 float(float idx) argv_end_index = #516; (DP_QC_TOKENIZE_CONSOLE)
-VM_buf_cvarlist,                                               // #517 void(float buf, string prefix) buf_cvarlist = #517; (DP_QC_STRINGBUFFERS_CVARLIST)
+VM_buf_cvarlist,                                               // #517 void(float buf, string prefix, string antiprefix) buf_cvarlist = #517; (DP_QC_STRINGBUFFERS_CVARLIST)
 VM_cvar_description,                                   // #518 float(string name) cvar_description = #518; (DP_QC_CVAR_DESCRIPTION)
 NULL,                                                                  // #519
 NULL,                                                                  // #520
index 3356fda..51559a9 100644 (file)
@@ -439,6 +439,7 @@ float CVAR_TYPEFLAG_SAVED = 2;
 float CVAR_TYPEFLAG_PRIVATE = 4;
 float CVAR_TYPEFLAG_ENGINE = 8;
 float CVAR_TYPEFLAG_HASDESCRIPTION = 16;
+float CVAR_TYPEFLAG_READONLY = 32;
 =================
 */
 void VM_cvar_type (void)
@@ -468,6 +469,8 @@ void VM_cvar_type (void)
                ret |= 8; // CVAR_TYPE_ENGINE
        if(cvar->description != cvar_dummy_description)
                ret |= 16; // CVAR_TYPE_HASDESCRIPTION
+       if(cvar->flags & CVAR_READONLY)
+               ret |= 32; // CVAR_TYPE_READONLY
        
        PRVM_G_FLOAT(OFS_RETURN) = ret;
 }
@@ -4391,12 +4394,12 @@ void VM_bufstr_free (void)
 void VM_buf_cvarlist(void)
 {
        cvar_t *cvar;
-       const char *partial;
-       size_t len;
+       const char *partial, *antipartial;
+       size_t len, antilen;
        size_t alloclen;
        int n;
        prvm_stringbuffer_t     *stringbuffer;
-       VM_SAFEPARMCOUNT(2, VM_bufstr_free);
+       VM_SAFEPARMCOUNTRANGE(2, 3, VM_buf_cvarlist);
 
        stringbuffer = (prvm_stringbuffer_t *)Mem_ExpandableArray_RecordAtIndex(&prog->stringbuffersarray, (int)PRVM_G_FLOAT(OFS_PARM0));
        if(!stringbuffer)
@@ -4410,6 +4413,15 @@ void VM_buf_cvarlist(void)
                len = 0;
        else
                len = strlen(partial);
+
+       if(prog->argc == 3)
+               antipartial = PRVM_G_STRING(OFS_PARM2);
+       else
+               antipartial = NULL;
+       if(!antipartial)
+               antilen = 0;
+       else
+               antilen = strlen(antipartial);
        
        for (n = 0;n < stringbuffer->num_strings;n++)
                if (stringbuffer->strings[n])
@@ -4433,7 +4445,10 @@ void VM_buf_cvarlist(void)
        n = 0;
        for(cvar = cvar_vars; cvar; cvar = cvar->next)
        {
-               if(partial && strncasecmp(partial, cvar->name, len))
+               if(len && strncasecmp(partial, cvar->name, len))
+                       continue;
+
+               if(antilen && !strncasecmp(antipartial, cvar->name, antilen))
                        continue;
 
                alloclen = strlen(cvar->name) + 1;
index 08440e6..3fcba47 100644 (file)
@@ -3422,7 +3422,7 @@ VM_uri_get,                                               // #513 float(string uril, float id) uri_get = #513; (DP_QC_URI
 VM_tokenize_console,                                   // #514 float(string str) tokenize_console = #514; (DP_QC_TOKENIZE_CONSOLE)
 VM_argv_start_index,                                   // #515 float(float idx) argv_start_index = #515; (DP_QC_TOKENIZE_CONSOLE)
 VM_argv_end_index,                                             // #516 float(float idx) argv_end_index = #516; (DP_QC_TOKENIZE_CONSOLE)
-VM_buf_cvarlist,                                               // #517 void(float buf, string prefix) buf_cvarlist = #517; (DP_QC_STRINGBUFFERS_CVARLIST)
+VM_buf_cvarlist,                                               // #517 void(float buf, string prefix, string antiprefix) buf_cvarlist = #517; (DP_QC_STRINGBUFFERS_CVARLIST)
 VM_cvar_description,                                   // #518 float(string name) cvar_description = #518; (DP_QC_CVAR_DESCRIPTION)
 NULL,                                                  // #519
 };