]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host.c
oops... too many colors in xpm
[xonotic/darkplaces.git] / host.c
diff --git a/host.c b/host.c
index 4545270975be8e8b2c23a4db04dafe56b6b12f7c..0bafb91ad6076e4d898bd50d1966b92d399afdd5 100644 (file)
--- a/host.c
+++ b/host.c
@@ -528,9 +528,6 @@ void Host_ShutdownServer(void)
 
 // make sure all the clients know we're disconnecting
        SV_VM_Begin();
-       for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
-               if (host_client->active)
-                       SV_DropClient(false); // server shutdown
        if(prog->loaded)
                if(prog->funcoffsets.SV_Shutdown)
                {
@@ -538,6 +535,9 @@ void Host_ShutdownServer(void)
                        prog->funcoffsets.SV_Shutdown = 0; // prevent it from getting called again
                        PRVM_ExecuteProgram(s,"SV_Shutdown() required");
                }
+       for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
+               if (host_client->active)
+                       SV_DropClient(false); // server shutdown
        SV_VM_End();
 
        NetConn_CloseServerPorts();
@@ -695,22 +695,15 @@ void Host_Main(void)
                        wait = cl_timer * -1000000.0;
                else
                        wait = max(cl_timer, sv_timer) * -1000000.0;
-               if (wait > 100000)
-                       wait = 100000;
+               wait = bound(0, wait, 100000);
 
-               if (!cls.timedemo && wait > 0)
+               if (!cls.timedemo && wait >= 1)
                {
                        double time0 = Sys_DoubleTime();
                        if (sv_checkforpacketsduringsleep.integer)
-                       {
-                               if (wait >= 1)
-                                       NetConn_SleepMicroseconds((int)wait);
-                       }
+                               NetConn_SleepMicroseconds((int)wait);
                        else
-                       {
-                               if (wait >= 1000)
-                                       Sys_Sleep((int)wait / 1000);
-                       }
+                               Sys_Sleep((int)wait);
                        svs.perf_acc_sleeptime += Sys_DoubleTime() - time0;
                        continue;
                }