]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Call ClientPreConnect on server QC
authorMattia Basaglia <mattia.basaglia@gmail.com>
Thu, 15 Jan 2015 09:20:02 +0000 (10:20 +0100)
committerMattia Basaglia <mattia.basaglia@gmail.com>
Thu, 15 Jan 2015 09:20:02 +0000 (10:20 +0100)
dpdefs/progsdefs.qc
progdefs.h
prvm_offsets.h
sv_main.c

index 2ccd843145b0db8807a777d9285bf2e5e60478b8..5a360fc210df0b7e6899858542d920e7c44ba801 100644 (file)
@@ -73,6 +73,7 @@ void()                PlayerPreThink;
 void()                 PlayerPostThink;
 
 void()         ClientKill;
+void()         ClientPreConnect;
 void()         ClientConnect;
 void()                 PutClientInServer;              // call after setting the parm1... parms
 void()         ClientDisconnect;
index 7086dbdc459767c2d70a87b8e7d92cd5e8d4cd78..a819327c0f63a017817a1acfd68a6a2291870412 100644 (file)
@@ -75,6 +75,7 @@ typedef struct globalvars_s
        func_t  PlayerPreThink;
        func_t  PlayerPostThink;
        func_t  ClientKill;
+       func_t  ClientPreConnect;
        func_t  ClientConnect;
        func_t  PutClientInServer;
        func_t  ClientDisconnect;
index fcb57ad0c3d63b21d5c14c7e6312e688d2cca5a1..4bcf8cb2d6540c6daac98f3bad79f33cc5e2fd86 100644 (file)
@@ -413,6 +413,7 @@ PRVM_DECLARE_function(CSQC_Parse_StuffCmd)
 PRVM_DECLARE_function(CSQC_Parse_TempEntity)
 PRVM_DECLARE_function(CSQC_Shutdown)
 PRVM_DECLARE_function(CSQC_UpdateView)
+PRVM_DECLARE_function(ClientPreConnect)
 PRVM_DECLARE_function(ClientConnect)
 PRVM_DECLARE_function(ClientDisconnect)
 PRVM_DECLARE_function(ClientKill)
@@ -774,6 +775,7 @@ PRVM_DECLARE_serverfieldvector(size)
 PRVM_DECLARE_serverfieldvector(v_angle)
 PRVM_DECLARE_serverfieldvector(velocity)
 PRVM_DECLARE_serverfieldvector(view_ofs)
+PRVM_DECLARE_serverfunction(ClientPreConnect)
 PRVM_DECLARE_serverfunction(ClientConnect)
 PRVM_DECLARE_serverfunction(ClientDisconnect)
 PRVM_DECLARE_serverfunction(ClientKill)
index bfe2a794a81e34f28b36689542252cb9dd7f5a67..e2d22afae5526ea7e5bb07829131a8a41f453094 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -1122,6 +1122,14 @@ void SV_ConnectClient (int clientnum, netconn_t *netconnection)
 
                // set up the entity for this client (including .colormap, .team, etc)
                PRVM_ED_ClearEdict(prog, client->edict);
+               
+               // call server hook
+               if (PRVM_serverfunction(ClientPreConnect))
+               {
+                       PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(client->edict);
+                       prog->ExecuteProgram(prog, PRVM_serverfunction(ClientPreConnect), 
+                               "QC function ClientPreConnect is missing");
+               }
        }
 
        // don't call SendServerinfo for a fresh botclient because its fields have