From 8a17bac4268551bf8bf1400b13ddc4eb2d30fa76 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 18 Jul 2017 12:33:31 +1000 Subject: [PATCH] Port clientdata to ClientState --- qcsrc/common/state.qc | 2 +- qcsrc/server/client.qc | 14 +++++++------- qcsrc/server/client.qh | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/qcsrc/common/state.qc b/qcsrc/common/state.qc index 7013cff1c..d3fd1d3bf 100644 --- a/qcsrc/common/state.qc +++ b/qcsrc/common/state.qc @@ -72,6 +72,7 @@ void ClientState_detach(entity this) accuracy_free(this); // TODO: needs to be before CS() is deleted! PlayerScore_Detach(this); // what ^they^ said W_HitPlotClose(this); + ClientData_Detach(this); delete(CS(this)); this._cs = NULL; @@ -82,5 +83,4 @@ void ClientState_detach(entity this) anticheat_report_to_eventlog(this); playerdemo_shutdown(this); entcs_detach(this); - ClientData_Detach(this); } diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index bfb8849c3..400d4b5b8 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -135,23 +135,23 @@ bool ClientData_Send(entity this, entity to, int sf) void ClientData_Attach(entity this) { - Net_LinkEntity(this.clientdata = new_pure(clientdata), false, 0, ClientData_Send); - this.clientdata.drawonlytoclient = this; - this.clientdata.owner = this; + Net_LinkEntity(CS(this).clientdata = new_pure(clientdata), false, 0, ClientData_Send); + CS(this).clientdata.drawonlytoclient = this; + CS(this).clientdata.owner = this; } void ClientData_Detach(entity this) { - delete(this.clientdata); - this.clientdata = NULL; + delete(CS(this).clientdata); + CS(this).clientdata = NULL; } void ClientData_Touch(entity e) { - e.clientdata.SendFlags = 1; + CS(e).clientdata.SendFlags = 1; // make it spectatable - FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != e && IS_SPEC(it) && it.enemy == e, LAMBDA(it.clientdata.SendFlags = 1)); + FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != e && IS_SPEC(it) && it.enemy == e, LAMBDA(CS(it).clientdata.SendFlags = 1)); } void SetSpectatee(entity this, entity spectatee); diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index 0c3eddfeb..e23c69bae 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -106,6 +106,7 @@ CLASS(Client, Object) ATTRIB(Client, scorekeeper, entity, this.scorekeeper); ATTRIB(Client, specialcommand_pos, int, this.specialcommand_pos); ATTRIB(Client, hitplotfh, int, this.hitplotfh); + ATTRIB(Client, clientdata, entity, this.clientdata); METHOD(Client, m_unwind, bool(Client this)); -- 2.39.2