foxygit / doom Log in
commit a9a551bdcc08d10de8f8f526b66e042c30486cf3
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Mon Jan 23 00:37:14 2006 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Mon Jan 23 00:37:14 2006 +0000

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

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 335
---
 src/net_gui.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/net_gui.c b/src/net_gui.c
index 3cf3ad0c..b830279f 100644
--- 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 @@ static void DrawScreen(void)

 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 @@ void NET_WaitForStart(void)
             I_Error("Disconnected from server");
         }

-        I_Sleep(50);
+        I_Sleep(1);
     }

     TXT_Shutdown();