From: Mattia Basaglia Date: Thu, 15 Jan 2015 09:20:02 +0000 (+0100) Subject: Call ClientPreConnect on server QC X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5f19899fd978adddb7e841e54647de720afff027;p=xonotic%2Fdarkplaces.git Call ClientPreConnect on server QC --- diff --git a/dpdefs/progsdefs.qc b/dpdefs/progsdefs.qc index 2ccd8431..5a360fc2 100644 --- a/dpdefs/progsdefs.qc +++ b/dpdefs/progsdefs.qc @@ -73,6 +73,7 @@ void() PlayerPreThink; void() PlayerPostThink; void() ClientKill; +void() ClientPreConnect; void() ClientConnect; void() PutClientInServer; // call after setting the parm1... parms void() ClientDisconnect; diff --git a/progdefs.h b/progdefs.h index 7086dbdc..a819327c 100644 --- a/progdefs.h +++ b/progdefs.h @@ -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; diff --git a/prvm_offsets.h b/prvm_offsets.h index fcb57ad0..4bcf8cb2 100644 --- a/prvm_offsets.h +++ b/prvm_offsets.h @@ -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) diff --git a/sv_main.c b/sv_main.c index bfe2a794..e2d22afa 100644 --- 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