Xonotic
state.qh File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ClientState
 Purpose: common client state, usable on client and server Client: singleton representing the viewed player Server: instance per client. More...
 
class  PlayerState
 Purpose: common player state, usable on client and server Client: singleton representing the viewed player Server: instance per client, clients decoupled from players. More...
 

Macros

#define CS_CVAR(this)   (this)
 
#define PS(this)   ((this)._ps)
 

Functions

void ClientState_attach (entity this)
 
void ClientState_detach (entity this)
 
ClientState CS (Client this)
 
void PlayerState_attach (entity this)
 
void PlayerState_detach (entity this)
 

Variables

ClientState _cs
 
PlayerState _ps
 

Macro Definition Documentation

◆ CS_CVAR

◆ PS

Function Documentation

◆ ClientState_attach()

void ClientState_attach ( entity  this)

Definition at line 46 of file state.qc.

47 {
48  this._cs = NEW(ClientState, this);
49 
50  // TODO: fold all of these into ClientState
51 
52  DecodeLevelParms(this);
53 
54  PlayerScore_Attach(this);
55  PlayerStats_PlayerBasic_CheckUpdate(this);
56  ClientData_Attach(this);
57  accuracy_init(this);
58  entcs_attach(this);
59  anticheat_init(this);
60  W_HitPlotOpen(this);
62  StatusEffectsStorage_attach(this);
63 }
#define NEW(cname,...)
Definition: oo.qh:105
void DecodeLevelParms(entity this)
Definition: client.qc:934
void entcs_attach(entity this)
void accuracy_init(entity this)
Definition: accuracy.qc:45
void ClientData_Attach(entity this)
Definition: client.qc:158
void anticheat_init(entity this)
Definition: anticheat.qc:240
ClientState _cs
Definition: state.qh:42
void PlayerScore_Attach(entity this)
Definition: scores.qc:318
void InventoryStorage_attach(PlayerState this)
void W_HitPlotOpen(entity this)
Definition: hitplot.qc:82
Purpose: common client state, usable on client and server Client: singleton representing the viewed p...
Definition: state.qh:29

◆ ClientState_detach()

void ClientState_detach ( entity  this)

Definition at line 73 of file state.qc.

References _cs, accuracy_free(), anticheat_report_to_eventlog(), bot_clientdisconnect(), ClientData_Detach(), CS(), CS_CVAR, entcs_detach(), GetCvars(), InventoryStorage_delete(), NULL, PlayerScore_Detach(), and W_HitPlotClose().

Referenced by ClientDisconnect().

74 {
75  GetCvars(this, CS_CVAR(this), -1); // free cvars TODO: is this still needed now that it's stored on the clientstate entity?
76  accuracy_free(this); // TODO: needs to be before CS() is deleted!
77  PlayerScore_Detach(this); // what ^they^ said
78  W_HitPlotClose(this);
79  ClientData_Detach(this);
80  entcs_detach(this);
82  StatusEffectsStorage_delete(this);
83  delete(CS(this));
84  this._cs = NULL;
85 
87 
89 }
void entcs_detach(entity this)
void PlayerScore_Detach(entity this)
Definition: scores.qc:328
void InventoryStorage_delete(PlayerState this)
void anticheat_report_to_eventlog(entity this)
Definition: anticheat.qc:195
ClientState CS(Client this)
Definition: state.qh:47
#define CS_CVAR(this)
Definition: state.qh:51
ClientState _cs
Definition: state.qh:42
void GetCvars(entity this, entity store, int f)
Definition: getreplies.qc:381
void ClientData_Detach(entity this)
Definition: client.qc:165
void W_HitPlotClose(entity this)
Definition: hitplot.qc:92
#define NULL
Definition: post.qh:17
void accuracy_free(entity this)
Definition: accuracy.qc:53
void bot_clientdisconnect(entity this)
Definition: bot.qc:411
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CS()

ClientState CS ( Client  this)

Definition at line 47 of file state.qh.

References _cs, assert, and TC.

Referenced by accuracy_add(), accuracy_free(), accuracy_init(), accuracy_resend(), accuracy_reset(), accuracy_send(), anticheat_fixangle(), anticheat_init(), anticheat_physics(), anticheat_prethink(), anticheat_report_to_eventlog(), anticheat_report_to_playerstats(), anticheat_spectatecopy(), antilag_restore_all(), antilag_takeback_all(), BanCommand_mute(), BanCommand_unmute(), bot_cmd_impulse(), bot_cmd_pause(), bot_lagfunc(), bot_presskeys(), bot_think(), botframe_autowaypoints_fix_from(), ChatBubbleThink(), client_hasweapon(), ClientCommand_clientversion(), ClientCommand_join(), ClientCommand_minigame(), ClientCommand_selectteam(), ClientConnect(), ClientData_Attach(), ClientData_Detach(), ClientData_Send(), ClientData_Touch(), ClientDisconnect(), ClientState_detach(), CommonCommand_timeout(), CommonCommand_who(), crosshair_trace(), ctf_FlagThink(), Damage(), DecodeLevelParms(), Drag(), DumpStats(), EndFrame(), FireRailgunBullet(), FixPlayermodel(), frag_centermessage_override(), GameCommand_nospectators(), GetClientVersionMessage(), GetPlayerScoreString(), GetPressedKeys(), Handicap_GetForcedHandicap(), Handicap_Initialize(), Handicap_SetForcedHandicap(), havocbot_ai(), havocbot_aim(), havocbot_ctf_reset_role(), havocbot_keyboard_movement(), havocbot_movetogoal(), Heal(), ImpulseCommands(), invite_minigame(), IsFlying(), joinAllowed(), lms_RemovePlayer(), MapVote_Tick(), minigame_addplayer(), minigame_find_player(), MinigameImpulse(), MUTATOR_HOOKFUNCTION(), Obituary(), ObserverOrSpectatorThink(), part_minigame(), PingPLReport_Think(), player_clear_minigame(), Player_Physics(), Player_SetTeamIndexChecked(), PlayerDamage(), PlayerPostThink(), PlayerPreThink(), PlayerScore_Add(), PlayerScore_Attach(), PlayerScore_Clear(), PlayerScore_Detach(), PlayerScore_PlayerStats(), PlayerScore_Set(), PlayerScore_Sort(), PlayerTeamScore_Compare(), PlayerThink(), PM_check_specialcommand(), PrintWelcomeMessage(), PutObserverInServer(), PutPlayerInServer(), race_AbandonRaceCheck(), race_GetFractionalLapCount(), race_SendTime(), ReadyRestart_force(), reset_map(), Say(), Score_ClearAll(), Score_NicePrint_Player(), SetChangeParms(), SetPlayerTeam(), SetSpectatee_status(), SetZoomState(), ShowTeamSelection(), SpectateCopy(), STATIC_INIT(), SV_ParseClientCommand_floodcheck(), sys_phys_monitor(), sys_phys_override(), sys_phys_spectator_control(), vehicles_enter(), W_HitPlotAnalysis(), W_HitPlotClose(), W_HitPlotOpen(), W_Nexball_Touch(), W_SetupShot_Dir_ProjectileSize_Range(), WarpZone_crosshair_trace(), WarpZone_Projectile_Touch(), WinningCondition_Race(), and WinningConditionHelper().

47 { TC(Client, this); assert(this._cs); return this._cs; }
#define assert(expr,...)
Definition: log.qh:8
ClientState _cs
Definition: state.qh:42
#define TC(T, sym)
Definition: _all.inc:82
Definition: client.qh:88
+ Here is the caller graph for this function:

◆ PlayerState_attach()

void PlayerState_attach ( entity  this)

Definition at line 12 of file state.qc.

References _ps, Inventory_new(), NEW, and PS.

Referenced by PutPlayerInServer().

13 {
14  if (PS(this) && PS(this).m_client == this)
15  return;
16 
17  this._ps = NEW(PlayerState, this);
18 
19  Inventory_new(PS(this));
20 }
#define NEW(cname,...)
Definition: oo.qh:105
#define PS(this)
Definition: state.qh:18
PlayerState _ps
Definition: state.qh:17
Purpose: common player state, usable on client and server Client: singleton representing the viewed p...
Definition: state.qh:8
void Inventory_new(PlayerState this)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PlayerState_detach()

void PlayerState_detach ( entity  this)

Definition at line 22 of file state.qc.

References accuracy_init(), anticheat_init(), bot_clientconnect(), ClientData_Attach(), DecodeLevelParms(), entcs_attach(), entity(), FOREACH_CLIENT, Inventory_clear(), Inventory_delete(), NULL, PlayerScore_Attach(), PS, and W_HitPlotOpen().

Referenced by PutObserverInServer().

23 {
24  PlayerState ps = PS(this);
25  if (!ps) return; // initial connect
26  PS(this) = NULL;
27  Inventory_clear(this.inventory_store); // no need to network updates, as there is no inventory attached
28 
29  if (ps.m_client != this) return; // don't own state, spectator
30  ps.ps_push(ps, this);
31  Inventory_delete(ps);
32 
33  FOREACH_CLIENT(PS(it) == ps, { PS(it) = NULL; });
34  delete(ps);
35 }
#define FOREACH_CLIENT(cond, body)
Definition: utils.qh:49
#define PS(this)
Definition: state.qh:18
#define NULL
Definition: post.qh:17
Purpose: common player state, usable on client and server Client: singleton representing the viewed p...
Definition: state.qh:8
void Inventory_clear(PlayerState this)
void Inventory_delete(entity this)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ _cs

Definition at line 42 of file state.qh.

Referenced by ClientState_attach(), ClientState_detach(), and CS().

◆ _ps

Definition at line 17 of file state.qh.

Referenced by CopyBody(), and PlayerState_attach().