shithub: choc

Download patch

ref: 14a26c3d0825a67eedffa37af5fb463776c4a7bb
parent: 433a6e9e411fb188991d5d78df4b04dd81b2baac
author: Simon Howard <[email protected]>
date: Thu Oct 5 13:18:14 EDT 2006

Packet loss simulation code for test.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 684

--- a/src/net_sdl.c
+++ b/src/net_sdl.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: net_sdl.c 611 2006-09-17 18:01:16Z fraggle $
+// $Id: net_sdl.c 684 2006-10-05 17:18:14Z fraggle $
 //
 // Copyright(C) 2005 Simon Howard
 //
@@ -189,6 +189,10 @@
     
     recvpacket = SDLNet_AllocPacket(1500);
 
+#ifdef DROP_PACKETS
+    srand(time(NULL));
+#endif
+
     return true;
 }
 
@@ -210,6 +214,9 @@
     }
 
     recvpacket = SDLNet_AllocPacket(1500);
+#ifdef DROP_PACKETS
+    srand(time(NULL));
+#endif
 
     return true;
 }
@@ -243,6 +250,11 @@
             this_second_sent = 0;
         }
     }
+#endif
+
+#ifdef DROP_PACKETS
+    if ((rand() % 4) == 0)
+        return;
 #endif
 
     sdl_packet.channel = 0;