shithub: choc

Download patch

ref: a9a551bdcc08d10de8f8f526b66e042c30486cf3
parent: 92b3eeba514afec641892ecb090356027156f9ee
author: Simon Howard <[email protected]>
date: Sun Jan 22 19:37:14 EST 2006

Make the network waiting screen not thrash the CPU so much.

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

--- a/src/net_gui.c
+++ b/src/net_gui.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: net_gui.c 294 2006-01-14 00:27:16Z fraggle $
+// $Id: net_gui.c 335 2006-01-23 00:37:14Z fraggle $
 //
 // Copyright(C) 2005 Simon Howard
 //
@@ -21,6 +21,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.13  2006/01/23 00:37:14  fraggle
+// Make the network waiting screen not thrash the CPU so much.
+//
 // Revision 1.12  2006/01/14 00:27:16  fraggle
 // Set the window caption and title
 //
@@ -168,14 +171,22 @@
 
 void NET_WaitForStart(void)
 {
+    int last_draw_time;
+    
     TXT_Init();
     I_SetWindowCaption();
     I_SetWindowIcon();
 
+    last_draw_time = -1;
+
     while (net_waiting_for_start)
     {
-        ProcessEvents();
-        DrawScreen();
+	if (I_GetTimeMS() > last_draw_time + 50)
+	{
+	    ProcessEvents();
+            DrawScreen();
+	    last_draw_time = I_GetTimeMS();
+	}
 
         NET_CL_Run();
         NET_SV_Run();
@@ -185,7 +196,7 @@
             I_Error("Disconnected from server");
         }
 
-        I_Sleep(50);
+        I_Sleep(1);
     }
     
     TXT_Shutdown();