]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_main.c
cl_main: Slight refactor
[xonotic/darkplaces.git] / cl_main.c
index d9256f16917dc859b178a7e8ce71cbd4c67ef71b..c55c543e3537e2d48470b840016e3148f56c5564 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -428,6 +428,8 @@ void CL_Disconnect(void)
        cls.demoplayback = cls.timedemo = host.restless = false;
        cls.signon = 0;
 
+       Cvar_Callback(&cl_netport);
+
        // If we're dropped mid-connection attempt, it won't clear otherwise.
        SCR_ClearLoadingScreen(false);
 }
@@ -2751,7 +2753,6 @@ double CL_Frame (double time)
        static double clframetime;
        static double cl_timer = 0;
        static double time1 = 0, time2 = 0, time3 = 0;
-       static double wait;
        int pass1, pass2, pass3;
 
        CL_VM_PreventInformationLeaks();
@@ -2794,9 +2795,8 @@ double CL_Frame (double time)
                {
                        clframetime = cl.realframetime = max(cl_timer, 1.0 / cl_maxfps.value);
                        // when running slow, we need to sleep to keep input responsive
-                       wait = bound(0, cl_maxfps_alwayssleep.value * 1000, 100000);
-                       if (wait > 0)
-                               Sys_Sleep((int)wait);
+                       if (cl_maxfps_alwayssleep.value > 0)
+                               Sys_Sleep((int)bound(0, cl_maxfps_alwayssleep.value * 1000, 100000));
                }
                else if (!vid_activewindow && cl_maxidlefps.value >= 1 && !cls.timedemo)
                        clframetime = cl.realframetime = max(cl_timer, 1.0 / cl_maxidlefps.value);
@@ -3084,6 +3084,8 @@ void CL_Init (void)
 
                CL_Video_Init();
 
+               NetConn_UpdateSockets_Client();
+
                host.hook.ConnectLocal = CL_EstablishConnection_Local;
                host.hook.Disconnect = CL_Disconnect;
                host.hook.CL_Intermission = CL_Intermission;