reduced cl_net* cvars to just cl_netlocalping and cl_netpacketloss and removed sv_net...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 15 Oct 2004 06:56:18 +0000 (06:56 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 15 Oct 2004 06:56:18 +0000 (06:56 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4630 d7cf8633-e32d-0410-b094-e92efae38249

lhnet.c
netconn.c
netconn.h

diff --git a/lhnet.c b/lhnet.c
index ede0e7e..4b33180 100644 (file)
--- a/lhnet.c
+++ b/lhnet.c
@@ -565,7 +565,7 @@ int LHNET_Read(lhnetsocket_t *lhnetsocket, void *content, int maxcontentlength,
                                continue;
                        }
 #ifndef STANDALONETEST
-                       if (p->sentdoubletime && Sys_DoubleTime() < p->sentdoubletime)
+                       if (cl_netlocalping.value && (Sys_DoubleTime() - cl_netlocalping.value * 1000.0) < p->sentdoubletime)
                                continue;
 #endif
                        if (value == 0 && p->destinationport == lhnetsocket->address.addressdata.loop.port)
@@ -681,8 +681,7 @@ int LHNET_Write(lhnetsocket_t *lhnetsocket, const void *content, int contentleng
                p->next->prev = p;
                p->prev->next = p;
 #ifndef STANDALONETEST
-               if (cl_netlocalping_min.value || cl_netlocalping_max.value)
-                       p->sentdoubletime = Sys_DoubleTime() + lhrandom(cl_netlocalping_min.value, cl_netlocalping_max.value) * (0.5 / 1000.0);
+               p->sentdoubletime = Sys_DoubleTime();
 #endif
                value = contentlength;
        }
index 3765ef2..c3b43d1 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -49,12 +49,8 @@ cvar_t net_connecttimeout = {0, "net_connecttimeout","10"};
 cvar_t hostname = {CVAR_SAVE, "hostname", "UNNAMED"};
 cvar_t developer_networking = {0, "developer_networking", "0"};
 
-cvar_t cl_netlocalping_min = {0, "cl_netlocalping_min","0"};
-cvar_t cl_netlocalping_max = {0, "cl_netlocalping_max","0"};
-static cvar_t cl_netpacketloss_receive = {0, "cl_netpacketloss_receive","0"};
-static cvar_t cl_netpacketloss_send = {0, "cl_netpacketloss_send","0"};
-static cvar_t sv_netpacketloss_receive = {0, "sv_netpacketloss_receive","0"};
-static cvar_t sv_netpacketloss_send = {0, "sv_netpacketloss_send","0"};
+cvar_t cl_netlocalping = {0, "cl_netlocalping","0"};
+static cvar_t cl_netpacketloss = {0, "cl_netpacketloss","0"};
 
 
 /* statistic counters */
@@ -98,13 +94,9 @@ int NetConn_Read(lhnetsocket_t *mysocket, void *data, int maxlength, lhnetaddres
 {
        int length = LHNET_Read(mysocket, data, maxlength, peeraddress);
        int i;
-       if (cl_netpacketloss_receive.integer)
+       if (cl_netpacketloss.integer)
                for (i = 0;i < cl_numsockets;i++)
-                       if (cl_sockets[i] == mysocket && (rand() % 100) < cl_netpacketloss_receive.integer)
-                               return 0;
-       if (sv_netpacketloss_receive.integer)
-               for (i = 0;i < cl_numsockets;i++)
-                       if (sv_sockets[i] == mysocket && (rand() % 100) < sv_netpacketloss_receive.integer)
+                       if (cl_sockets[i] == mysocket && (rand() % 100) < cl_netpacketloss.integer)
                                return 0;
        if (developer_networking.integer && length != 0)
        {
@@ -126,13 +118,9 @@ int NetConn_Write(lhnetsocket_t *mysocket, const void *data, int length, const l
 {
        int ret;
        int i;
-       if (cl_netpacketloss_send.integer)
-               for (i = 0;i < cl_numsockets;i++)
-                       if (cl_sockets[i] == mysocket && (rand() % 100) < cl_netpacketloss_send.integer)
-                               return length;
-       if (sv_netpacketloss_send.integer)
+       if (cl_netpacketloss.integer)
                for (i = 0;i < cl_numsockets;i++)
-                       if (sv_sockets[i] == mysocket && (rand() % 100) < sv_netpacketloss_send.integer)
+                       if (cl_sockets[i] == mysocket && (rand() % 100) < cl_netpacketloss.integer)
                                return length;
        ret = LHNET_Write(mysocket, data, length, peeraddress);
        if (developer_networking.integer)
@@ -1597,12 +1585,8 @@ void NetConn_Init(void)
        Cvar_RegisterVariable(&net_messagetimeout);
        Cvar_RegisterVariable(&net_messagerejointimeout);
        Cvar_RegisterVariable(&net_connecttimeout);
-       Cvar_RegisterVariable(&cl_netlocalping_min);
-       Cvar_RegisterVariable(&cl_netlocalping_max);
-       Cvar_RegisterVariable(&cl_netpacketloss_receive);
-       Cvar_RegisterVariable(&cl_netpacketloss_send);
-       Cvar_RegisterVariable(&sv_netpacketloss_receive);
-       Cvar_RegisterVariable(&sv_netpacketloss_send);
+       Cvar_RegisterVariable(&cl_netlocalping);
+       Cvar_RegisterVariable(&cl_netpacketloss);
        Cvar_RegisterVariable(&hostname);
        Cvar_RegisterVariable(&developer_networking);
        Cvar_RegisterVariable(&cl_netport);
index 7d35b38..cf7c5b7 100755 (executable)
--- a/netconn.h
+++ b/netconn.h
@@ -200,8 +200,7 @@ extern int serverreplycount;
 
 extern sizebuf_t net_message;
 
-extern cvar_t cl_netlocalping_min;
-extern cvar_t cl_netlocalping_max;
+extern cvar_t cl_netlocalping;
 
 int NetConn_SendReliableMessage(netconn_t *conn, sizebuf_t *data);
 //void NetConn_SendMessageNext(netconn_t *conn);