]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
patch from div0 that adds a special "extResponse " type of packet that can be returne...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 14 Jan 2007 09:56:30 +0000 (09:56 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 14 Jan 2007 09:56:30 +0000 (09:56 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6689 d7cf8633-e32d-0410-b094-e92efae38249

mvm_cmds.c
netconn.c
netconn.h

index 19f3ced7b7d422dd639b8182b6e6bd131db28c37..12c0af5b9456c55cfc793a9e654bab68302b1273 100644 (file)
@@ -782,6 +782,24 @@ void VM_M_WriteEntity (void)
        MSG_WriteShort (VM_WriteDest(), PRVM_G_EDICTNUM(OFS_PARM0));
 }
 
        MSG_WriteShort (VM_WriteDest(), PRVM_G_EDICTNUM(OFS_PARM0));
 }
 
+//string(void) getextresponse = #624; // returns the next extResponse packet that was sent to this client
+void VM_M_getextresponse (void)
+{
+       VM_SAFEPARMCOUNT(0,VM_argv);
+
+       if (net_extresponse_count <= 0)
+       {
+               PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(NULL);
+       }
+       else
+       {
+               int first;
+               --net_extresponse_count;
+               first = (net_extresponse_last + NET_EXTRESPONSE_MAX - net_extresponse_count) % NET_EXTRESPONSE_MAX;
+               PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(net_extresponse[first]);
+       }
+}
+
 prvm_builtin_t vm_m_builtins[] = {
        0, // to be consistent with the old vm
        // common builtings (mostly)
 prvm_builtin_t vm_m_builtins[] = {
        0, // to be consistent with the old vm
        // common builtings (mostly)
@@ -946,7 +964,8 @@ prvm_builtin_t vm_m_builtins[] = {
        VM_M_refreshserverlist,
        VM_M_getserverlistnumber,
        VM_M_getserverlistindexforkey,
        VM_M_refreshserverlist,
        VM_M_getserverlistnumber,
        VM_M_getserverlistindexforkey,
-       VM_M_addwantedserverlistkey // 623
+       VM_M_addwantedserverlistkey, // 623
+       VM_M_getextresponse
 };
 
 const int vm_m_numbuiltins = sizeof(vm_m_builtins) / sizeof(prvm_builtin_t);
 };
 
 const int vm_m_numbuiltins = sizeof(vm_m_builtins) / sizeof(prvm_builtin_t);
index 598199beb15aeeaa0c395de4dee548cb29833ecf..02f6b5a9e718ed5492b054e786f9b8ba5a8d3c31 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -126,6 +126,10 @@ cvar_t sv_netport = {0, "port", "26000", "server port for players to connect to"
 cvar_t net_address = {0, "net_address", "0.0.0.0", "network address to open ports on"};
 //cvar_t net_netaddress_ipv6 = {0, "net_address_ipv6", "[0:0:0:0:0:0:0:0]", "network address to open ipv6 ports on"};
 
 cvar_t net_address = {0, "net_address", "0.0.0.0", "network address to open ports on"};
 //cvar_t net_netaddress_ipv6 = {0, "net_address_ipv6", "[0:0:0:0:0:0:0:0]", "network address to open ipv6 ports on"};
 
+char net_extresponse[NET_EXTRESPONSE_MAX][1400];
+int net_extresponse_count = 0;
+int net_extresponse_last = 0;
+
 // ServerList interface
 serverlist_mask_t serverlist_andmasks[SERVERLIST_ANDMASKCOUNT];
 serverlist_mask_t serverlist_ormasks[SERVERLIST_ORMASKCOUNT];
 // ServerList interface
 serverlist_mask_t serverlist_andmasks[SERVERLIST_ANDMASKCOUNT];
 serverlist_mask_t serverlist_ormasks[SERVERLIST_ORMASKCOUNT];
@@ -1343,6 +1347,15 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat
                        serverlist_querywaittime = realtime + 3;
                        return true;
                }
                        serverlist_querywaittime = realtime + 3;
                        return true;
                }
+               if (!strncmp(string, "extResponse ", 12))
+               {
+                       ++net_extresponse_count;
+                       if(net_extresponse_count > NET_EXTRESPONSE_MAX)
+                               net_extresponse_count = NET_EXTRESPONSE_MAX;
+                       net_extresponse_last = (net_extresponse_last + 1) % NET_EXTRESPONSE_MAX;
+                       dpsnprintf(net_extresponse[net_extresponse_last], sizeof(net_extresponse[net_extresponse_last]), "%s %s", addressstring2, string + 12);
+                       return true;
+               }
                if (!strncmp(string, "ping", 4))
                {
                        if (developer.integer >= 10)
                if (!strncmp(string, "ping", 4))
                {
                        if (developer.integer >= 10)
index bbd1b88ed1cb3de1498bc284d78f0efa5e7490de..f158e359eff47f0fe04f4878e636bb096000d175 100755 (executable)
--- a/netconn.h
+++ b/netconn.h
@@ -37,6 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 
 #define NET_PROTOCOL_VERSION   3
 
 
 #define NET_PROTOCOL_VERSION   3
+#define NET_EXTRESPONSE_MAX 16
 
 // This is the network info/connection protocol.  It is used to find Quake
 // servers, get info about them, and connect to them.  Once connected, the
 
 // This is the network info/connection protocol.  It is used to find Quake
 // servers, get info about them, and connect to them.  Once connected, the
@@ -311,6 +312,10 @@ extern qboolean serverlist_consoleoutput;
 //
 //============================================================================
 
 //
 //============================================================================
 
+extern char net_extresponse[NET_EXTRESPONSE_MAX][1400];
+extern int net_extresponse_count;
+extern int net_extresponse_last;
+
 extern double masterquerytime;
 extern int masterquerycount;
 extern int masterreplycount;
 extern double masterquerytime;
 extern int masterquerycount;
 extern int masterreplycount;