extresponse: make svqc receive only those on the server socket, and csqc/menuqc only...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 14 Nov 2009 23:39:26 +0000 (23:39 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 14 Nov 2009 23:39:26 +0000 (23:39 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9498 d7cf8633-e32d-0410-b094-e92efae38249

clvm_cmds.c
mvm_cmds.c
netconn.c
netconn.h
prvm_cmds.c
prvm_cmds.h
svvm_cmds.c

index 03f3af9..89bea83 100644 (file)
@@ -4283,7 +4283,7 @@ NULL,                                                     // #620
 NULL,                                                  // #621
 NULL,                                                  // #622
 NULL,                                                  // #623
-VM_getextresponse,                             // #624 string getextresponse(void)
+VM_CL_getextresponse,                  // #624 string getextresponse(void)
 NULL,                                                  // #625
 };
 
index 29f4406..2bcf93f 100644 (file)
@@ -1402,7 +1402,7 @@ VM_M_refreshserverlist,                   // #620 void refreshhostcache(void)
 VM_M_getserverlistnumber,              // #621 float gethostcachenumber(float fld, float hostnr)
 VM_M_getserverlistindexforkey,// #622 float gethostcacheindexforkey(string key)
 VM_M_addwantedserverlistkey,   // #623 void addwantedhostcachekey(string key)
-VM_getextresponse,                             // #624 string getextresponse(void)
+VM_CL_getextresponse,                  // #624 string getextresponse(void)
 VM_netaddress_resolve,          // #625 string netaddress_resolve(string, float)
 VM_M_getgamedirinfo,            // #626 string getgamedirinfo(float n, float prop)
 NULL
index 906cdf0..f57265c 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -136,6 +136,10 @@ char net_extresponse[NET_EXTRESPONSE_MAX][1400];
 int net_extresponse_count = 0;
 int net_extresponse_last = 0;
 
+char sv_net_extresponse[NET_EXTRESPONSE_MAX][1400];
+int sv_net_extresponse_count = 0;
+int sv_net_extresponse_last = 0;
+
 // ServerList interface
 serverlist_mask_t serverlist_andmasks[SERVERLIST_ANDMASKCOUNT];
 serverlist_mask_t serverlist_ormasks[SERVERLIST_ORMASKCOUNT];
@@ -2789,11 +2793,11 @@ static int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, unsigned char *dat
                }
                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);
+                       ++sv_net_extresponse_count;
+                       if(sv_net_extresponse_count > NET_EXTRESPONSE_MAX)
+                               sv_net_extresponse_count = NET_EXTRESPONSE_MAX;
+                       sv_net_extresponse_last = (net_extresponse_last + 1) % NET_EXTRESPONSE_MAX;
+                       dpsnprintf(sv_net_extresponse[sv_net_extresponse_last], sizeof(sv_net_extresponse[net_extresponse_last]), "'%s' %s", addressstring2, string + 12);
                        return true;
                }
                if (!strncmp(string, "ping", 4))
index f7159d6..2a4ec7a 100755 (executable)
--- a/netconn.h
+++ b/netconn.h
@@ -373,6 +373,10 @@ extern char net_extresponse[NET_EXTRESPONSE_MAX][1400];
 extern int net_extresponse_count;
 extern int net_extresponse_last;
 
+extern char sv_net_extresponse[NET_EXTRESPONSE_MAX][1400];
+extern int sv_net_extresponse_count;
+extern int sv_net_extresponse_last;
+
 extern double masterquerytime;
 extern int masterquerycount;
 extern int masterreplycount;
index be7fc68..755c080 100644 (file)
@@ -5287,7 +5287,7 @@ void VM_netaddress_resolve (void)
 }
 
 //string(void) getextresponse = #624; // returns the next extResponse packet that was sent to this client
-void VM_getextresponse (void)
+void VM_CL_getextresponse (void)
 {
        VM_SAFEPARMCOUNT(0,VM_argv);
 
@@ -5302,6 +5302,21 @@ void VM_getextresponse (void)
        }
 }
 
+void VM_SV_getextresponse (void)
+{
+       VM_SAFEPARMCOUNT(0,VM_argv);
+
+       if (sv_net_extresponse_count <= 0)
+               PRVM_G_INT(OFS_RETURN) = OFS_NULL;
+       else
+       {
+               int first;
+               --sv_net_extresponse_count;
+               first = (sv_net_extresponse_last + NET_EXTRESPONSE_MAX - sv_net_extresponse_count) % NET_EXTRESPONSE_MAX;
+               PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(sv_net_extresponse[first]);
+       }
+}
+
 /*
 =========
 VM_M_callfunction
index b2e8527..1a836e2 100644 (file)
@@ -443,7 +443,8 @@ void VM_argv_end_index (void);
 void VM_buf_cvarlist(void);
 void VM_cvar_description(void);
 
-void VM_getextresponse (void);
+void VM_CL_getextresponse (void);
+void VM_SV_getextresponse (void);
 
 void VM_isfunction(void);
 void VM_callfunction(void);
index ce61e9f..c23aefb 100644 (file)
@@ -3701,7 +3701,7 @@ NULL,                                                     // #620
 NULL,                                                  // #621
 NULL,                                                  // #622
 NULL,                                                  // #623
-VM_getextresponse,                             // #624 string getextresponse(void)
+VM_SV_getextresponse,                  // #624 string getextresponse(void)
 NULL,                                                  // #625
 };