Xonotic
state.qh
Go to the documentation of this file.
1 #pragma once
2 
9  ATTRIB(PlayerState, m_client, entity);
11  {
13  this.m_client = client;
14  }
16 
17 .PlayerState _ps;
18 #define PS(this) ((this)._ps)
19 
20 // TODO: renew on death
21 void PlayerState_attach(entity this);
22 void PlayerState_detach(entity this);
23 
30  ATTRIB(ClientState, m_client, entity);
32  {
34  this.m_client = client;
35  }
36  METHOD(PlayerState, ps_push, void(PlayerState this, entity cl))
37  {
38  TC(PlayerState, this);
39  }
41 
42 .ClientState _cs;
43 
44 #if NDEBUG
45  #define CS(this) (this._cs)
46 #else
47  ClientState CS(Client this) { TC(Client, this); assert(this._cs); return this._cs; }
48 #endif
49 
50 // NOTE: this exists to ease migration later on - ClientState does not exist early enough for replicated cvars!
51 #define CS_CVAR(this) (this)
52 
53 void ClientState_attach(entity this);
54 void ClientState_detach(entity this);
#define assert(expr,...)
Definition: log.qh:8
CLASS(Object) Object
Definition: oo.qh:318
entity() spawn
ClientState CS(Client this)
Definition: state.qh:47
PlayerState _ps
Definition: state.qh:17
void PlayerState_attach(entity this)
Definition: state.qc:12
void ClientState_attach(entity this)
Definition: state.qc:46
#define METHOD(cname, name, prototype)
Definition: oo.qh:257
#define CONSTRUCT(cname,...)
Definition: oo.qh:111
#define ATTRIB(...)
Definition: oo.qh:136
ClientState _cs
Definition: state.qh:42
#define TC(T, sym)
Definition: _all.inc:82
Definition: client.qh:88
Purpose: common player state, usable on client and server Client: singleton representing the viewed p...
Definition: state.qh:8
void ClientState_detach(entity this)
Definition: state.qc:73
#define ENDCLASS(cname)
Definition: oo.qh:269
Purpose: common client state, usable on client and server Client: singleton representing the viewed p...
Definition: state.qh:29
void PlayerState_detach(entity this)
Definition: state.qc:22
#define CONSTRUCTOR(cname,...)
Definition: oo.qh:201