]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - lhnet.c
fixed a crash with lights that have no clusters (a light outside the level) by alloca...
[xonotic/darkplaces.git] / lhnet.c
diff --git a/lhnet.c b/lhnet.c
index ede0e7e2fd1c3032f101a5697680394e157f2e97..1060341f10abbbaa71d5f3b3e4fde84814288647 100644 (file)
--- a/lhnet.c
+++ b/lhnet.c
@@ -8,13 +8,13 @@
 #ifdef WIN32
 #include <winsock.h>
 #else
-#include <netdb.h>
-#include <netinet/in.h>
-//#include <arpa/inet.h>
 #include <unistd.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <errno.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
 #endif
 
 // for Z_Malloc/Z_Free in quake
@@ -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;
        }