]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
cleaned up SV_DropClient code a bit
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 12 Nov 2004 22:08:07 +0000 (22:08 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 12 Nov 2004 22:08:07 +0000 (22:08 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4738 d7cf8633-e32d-0410-b094-e92efae38249

host.c

diff --git a/host.c b/host.c
index a9b94def6706cef0454b939f40fa307b086acdcf..e1bf554098494ec2b10160f1e989a3c713480c7f 100644 (file)
--- a/host.c
+++ b/host.c
@@ -406,7 +406,6 @@ void SV_DropClient(qboolean crash)
        int i;
        Con_Printf("Client \"%s\" dropped\n", host_client->name);
 
-       // send any final messages (don't check for errors)
        if (host_client->netconnection)
        {
                // free the client (the body stays around)
@@ -416,22 +415,22 @@ void SV_DropClient(qboolean crash)
                        MSG_WriteByte(&host_client->message, svc_disconnect);
                        NetConn_SendUnreliableMessage(host_client->netconnection, &host_client->message);
                }
-
                // break the net connection
                NetConn_Close(host_client->netconnection);
                host_client->netconnection = NULL;
+       }
 
-               // LordHavoc: don't call QC if server is dead (avoids recursive
-               // Host_Error in some mods when they run out of edicts)
-               if (sv.active && host_client->edict && host_client->spawned)
-               {
-                       // call the prog function for removing a client
-                       // this will set the body to a dead frame, among other things
-                       int saveSelf = pr_global_struct->self;
-                       pr_global_struct->self = EDICT_TO_PROG(host_client->edict);
-                       PR_ExecuteProgram(pr_global_struct->ClientDisconnect, "QC function ClientDisconnect is missing");
-                       pr_global_struct->self = saveSelf;
-               }
+       // call qc ClientDisconnect function
+       // LordHavoc: don't call QC if server is dead (avoids recursive
+       // Host_Error in some mods when they run out of edicts)
+       if (host_client->active && sv.active && host_client->edict && host_client->spawned)
+       {
+               // call the prog function for removing a client
+               // this will set the body to a dead frame, among other things
+               int saveSelf = pr_global_struct->self;
+               pr_global_struct->self = EDICT_TO_PROG(host_client->edict);
+               PR_ExecuteProgram(pr_global_struct->ClientDisconnect, "QC function ClientDisconnect is missing");
+               pr_global_struct->self = saveSelf;
        }
 
        // remove leaving player from scoreboard