shithub: choc

Download patch

ref: 75f72e914b753c2f14f58958c37f968ca7ec1035
parent: db725c988cff2dd93306aa9139bdbbbea8af68db
author: Simon Howard <fraggle@gmail.com>
date: Thu Mar 30 14:16:06 EST 2006

When all players leave a server, start accepting new connections again.
This lets people run proper dedicated servers.

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

--- a/src/net_server.c
+++ b/src/net_server.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: net_server.c 455 2006-03-30 19:08:37Z fraggle $
+// $Id: net_server.c 457 2006-03-30 19:16:06Z fraggle $
 //
 // Copyright(C) 2005 Simon Howard
 //
@@ -1255,6 +1255,14 @@
         client->active = false;
         free(client->name);
         NET_FreeAddress(client->addr);
+
+        // Are there any clients left connected?  If not, return the
+        // server to the waiting-for-players state.
+
+        if (NET_SV_NumClients() <= 0)
+        {
+            server_state = SERVER_WAITING_START;
+        }
     }
     
     if (!ClientConnected(client))