]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - net_main.c
optimizing R_DrawSurfaces and WorldNode functions
[xonotic/darkplaces.git] / net_main.c
index 9cc149251d3d1af11d66c36f74e6c92c1040eef8..a7137ab3aea7ea599f1d95bc026904033b6b872e 100644 (file)
@@ -162,7 +162,7 @@ static void NET_Listen_f (void)
 
 static void MaxPlayers_f (void)
 {
-       int     n;
+       int n;
 
        if (Cmd_Argc () != 2)
        {
@@ -177,13 +177,9 @@ static void MaxPlayers_f (void)
        }
 
        n = atoi(Cmd_Argv(1));
-       if (n < 1)
-               n = 1;
-       if (n > svs.maxclientslimit)
-       {
-               n = svs.maxclientslimit;
+       n = bound(1, n, MAX_SCOREBOARD);
+       if (svs.maxclients != n)
                Con_Printf ("\"maxplayers\" set to \"%u\"\n", n);
-       }
 
        if ((n == 1) && listening)
                Cbuf_AddText ("listen 0\n");
@@ -191,7 +187,7 @@ static void MaxPlayers_f (void)
        if ((n > 1) && (!listening))
                Cbuf_AddText ("listen 1\n");
 
-       svs.maxclients = n;
+       SV_SetMaxClients(n);
 }
 
 
@@ -695,7 +691,7 @@ void NET_Init (void)
        }
        net_hostport = DEFAULTnet_hostport;
 
-       if (COM_CheckParm("-listen") || cls.state == ca_dedicated || gamemode == GAME_BLOODBATH)
+       if (COM_CheckParm("-listen") || cls.state == ca_dedicated || gamemode == GAME_TRANSFUSION)
                listening = true;
 
        SetNetTime();
@@ -737,14 +733,12 @@ NET_Shutdown
 ====================
 */
 
-void           NET_Shutdown (void)
+void NET_Shutdown (void)
 {
-       qsocket_t       *sock;
-
        SetNetTime();
 
-       for (sock = net_activeSockets;sock;sock = net_activeSockets)
-               NET_Close(sock);
+       while (net_activeSockets)
+               NET_Close(net_activeSockets);
 
 //
 // shutdown the drivers