]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix bug with ClientDisconnect not being called if a client drops between "spawn"...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 25 May 2005 07:17:44 +0000 (07:17 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 25 May 2005 07:17:44 +0000 (07:17 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5333 d7cf8633-e32d-0410-b094-e92efae38249

host.c
host_cmd.c
server.h
sv_main.c

diff --git a/host.c b/host.c
index 3a39f269c03b3c445877772e38dd848fdce4e466..9eaa3ba4d18a55c3bf7cc041c9e5235f610bfe6c 100644 (file)
--- a/host.c
+++ b/host.c
@@ -415,11 +415,12 @@ void SV_DropClient(qboolean crash)
        // 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)
+       if (host_client->clientconnectcalled && sv.active && host_client->edict)
        {
                // 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;
+               host_client->clientconnectcalled = false;
                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;
index d68b2518a44e87bc97f257789d32af3d2f1268a3..f28ac1763e31543a433d6a4e4c18b72ae3235565 100644 (file)
@@ -1279,6 +1279,7 @@ void Host_Spawn_f (void)
                        (&pr_global_struct->parm1)[i] = host_client->spawn_parms[i];
 
                // call the spawn function
+               host_client->clientconnectcalled = true;
                pr_global_struct->time = sv.time;
                pr_global_struct->self = EDICT_TO_PROG(host_client->edict);
                PR_ExecuteProgram (pr_global_struct->ClientConnect, "QC function ClientConnect is missing");
index a35b42cd4d3f81b2fd6fddf2e2ed553b638a58d1..51e5d6b2a4991ff7a43792d41e18a1708406b8d1 100644 (file)
--- a/server.h
+++ b/server.h
@@ -113,6 +113,8 @@ typedef struct client_s
 {
        // false = empty client slot
        qboolean active;
+       // false = don't do ClientDisconnect on drop
+       qboolean clientconnectcalled;
        // false = don't send datagrams
        qboolean spawned;
        // has been told to go to another level
index 44ae62c48b5338dff33b5a8634aac9293016b015..8818902a6b44febb6d4e51606d1f6e20b43c174b 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -291,6 +291,7 @@ void SV_SendServerinfo (client_t *client)
                        (&pr_global_struct->parm1)[i] = host_client->spawn_parms[i];
 
                // call the spawn function
+               host_client->clientconnectcalled = true;
                pr_global_struct->time = sv.time;
                pr_global_struct->self = EDICT_TO_PROG(client->edict);
                PR_ExecuteProgram (pr_global_struct->ClientConnect, "QC function ClientConnect is missing");