]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - mvm_cmds.c
patch from esteel making the findkeysforcommand builtin available in
[xonotic/darkplaces.git] / mvm_cmds.c
index 91bb20074002c7417c3b87d8914a4dbcebe1dfb6..d4c447b1909543010b486876b3b524b2e27746dc 100644 (file)
@@ -26,6 +26,8 @@ char *vm_m_extensions =
 "DP_QC_TOKENIZEBYSEPARATOR "
 "DP_QC_UNLIMITEDTEMPSTRINGS "
 "DP_QC_URI_ESCAPE "
+"DP_QC_URI_GET "
+"DP_QC_WHICHPACK "
 "FTE_STRINGS "
 ;
 
@@ -227,40 +229,6 @@ void VM_M_getresolution(void)
        PRVM_G_VECTOR(OFS_RETURN)[2] = 0;
 }
 
-/*
-=========
-VM_M_findkeysforcommand
-
-string findkeysforcommand(string command)
-
-the returned string is an altstring
-=========
-*/
-#define NUMKEYS 5 // TODO: merge the constant in keys.c with this one somewhen
-
-void M_FindKeysForCommand(const char *command, int *keys);
-void VM_M_findkeysforcommand(void)
-{
-       const char *cmd;
-       char ret[VM_STRINGTEMP_LENGTH];
-       int keys[NUMKEYS];
-       int i;
-
-       VM_SAFEPARMCOUNT(1, VM_M_findkeysforcommand);
-
-       cmd = PRVM_G_STRING(OFS_PARM0);
-
-       VM_CheckEmptyString(cmd);
-
-       M_FindKeysForCommand(cmd, keys);
-
-       ret[0] = 0;
-       for(i = 0; i < NUMKEYS; i++)
-               strlcat(ret, va(" \'%i\'", keys[i]), sizeof(ret));
-
-       PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(ret);
-}
-
 /*
 =========
 VM_M_getserverliststat
@@ -370,6 +338,12 @@ void VM_M_setserverlistmaskstring( void )
                case SLIF_NAME:
                        strlcpy( mask->info.name, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.name)  );
                        break;
+               case SLIF_QCSTATUS:
+                       strlcpy( mask->info.qcstatus, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.qcstatus)  );
+                       break;
+               case SLIF_PLAYERS:
+                       strlcpy( mask->info.players, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.players)  );
+                       break;
                case SLIF_MAP:
                        strlcpy( mask->info.map, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.map)  );
                        break;
@@ -496,6 +470,12 @@ void VM_M_getserverliststring(void)
                case SLIF_NAME:
                        PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.name );
                        break;
+               case SLIF_QCSTATUS:
+                       PRVM_G_INT (OFS_RETURN ) = PRVM_SetEngineString (cache->info.qcstatus );
+                       break;
+               case SLIF_PLAYERS:
+                       PRVM_G_INT (OFS_RETURN ) = PRVM_SetEngineString (cache->info.players );
+                       break;
                case SLIF_GAME:
                        PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.game );
                        break;
@@ -623,6 +603,10 @@ void VM_M_getserverlistindexforkey( void )
                PRVM_G_FLOAT( OFS_RETURN ) = SLIF_MAP;
        else if( !strcmp( key, "name" ) )
                PRVM_G_FLOAT( OFS_RETURN ) = SLIF_NAME;
+       else if( !strcmp( key, "qcstatus" ) )
+               PRVM_G_FLOAT( OFS_RETURN ) = SLIF_QCSTATUS;
+       else if( !strcmp( key, "players" ) )
+               PRVM_G_FLOAT( OFS_RETURN ) = SLIF_PLAYERS;
        else if( !strcmp( key, "maxplayers" ) )
                PRVM_G_FLOAT( OFS_RETURN ) = SLIF_MAXPLAYERS;
        else if( !strcmp( key, "numplayers" ) )
@@ -1329,7 +1313,7 @@ NULL,                                                                     // #499
 NULL,                                                                  // #500
 NULL,                                                                  // #501
 NULL,                                                                  // #502
-NULL,                                                                  // #503
+VM_whichpack,                                  // #503 string(string) whichpack = #503;
 NULL,                                                                  // #504
 NULL,                                                                  // #505
 NULL,                                                                  // #506
@@ -1339,7 +1323,7 @@ NULL,                                                                     // #509
 VM_uri_escape,                                 // #510 string(string in) uri_escape = #510;
 VM_uri_unescape,                               // #511 string(string in) uri_unescape = #511;
 VM_etof,                                       // #512 float(entity ent) num_for_edict = #512 (DP_QC_NUM_FOR_EDICT)
-NULL,                                                                  // #513
+VM_uri_get,                                            // #513 float(string uril, float id) uri_get = #513; (DP_QC_URI_GET)
 NULL,                                                                  // #514
 NULL,                                                                  // #515
 NULL,                                                                  // #516
@@ -1436,7 +1420,7 @@ VM_writetofile,                                   // #606 void writetofile(float fhandle, entity ent)
 VM_M_isfunction,                                       // #607 float isfunction(string function_name)
 VM_M_getresolution,                            // #608 vector getresolution(float number)
 VM_keynumtostring,                             // #609 string keynumtostring(float keynum)
-VM_M_findkeysforcommand,               // #610 string findkeysforcommand(string command)
+VM_findkeysforcommand,         // #610 string findkeysforcommand(string command)
 VM_M_getserverliststat,                        // #611 float gethostcachevalue(float type)
 VM_M_getserverliststring,              // #612 string gethostcachestring(float type, float hostnr)
 VM_parseentitydata,                            // #613 void parseentitydata(entity ent, string data)