Xonotic
handicap.qh File Reference

Header file that describes the handicap system. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

float Handicap_GetForcedHandicap (entity player)
 Returns the forced handicap of the player. More...
 
float Handicap_GetTotalHandicap (entity player)
 Returns the total handicap of the player. More...
 
float Handicap_GetVoluntaryHandicap (entity player)
 Returns the voluntary handicap of the player. More...
 
void Handicap_Initialize (entity player)
 Initializes handicap to its default value. More...
 
void Handicap_SetForcedHandicap (entity player, float value)
 Sets the forced handicap of the player. More...
 

Detailed Description

Header file that describes the handicap system.

Author
Lyberta

Definition in file handicap.qh.

Function Documentation

◆ Handicap_GetForcedHandicap()

float Handicap_GetForcedHandicap ( entity  player)

Returns the forced handicap of the player.

Parameters
[in]playerPlayer to check.
Returns
Forced handicap of the player.

Definition at line 23 of file handicap.qc.

References CS().

Referenced by Handicap_GetTotalHandicap().

24 {
25  return (CS(player)) ? CS(player).m_handicap : 1;
26 }
ClientState CS(Client this)
Definition: state.qh:47
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Handicap_GetTotalHandicap()

float Handicap_GetTotalHandicap ( entity  player)

Returns the total handicap of the player.

Parameters
[in]playerPlayer to check.
Returns
Total handicap of the player.

Definition at line 37 of file handicap.qc.

References Handicap_GetForcedHandicap(), and Handicap_GetVoluntaryHandicap().

Referenced by PlayerDamage().

38 {
40  player);
41 }
float Handicap_GetVoluntaryHandicap(entity player)
Returns the voluntary handicap of the player.
Definition: handicap.qc:18
float Handicap_GetForcedHandicap(entity player)
Returns the forced handicap of the player.
Definition: handicap.qc:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Handicap_GetVoluntaryHandicap()

float Handicap_GetVoluntaryHandicap ( entity  player)

Returns the voluntary handicap of the player.

Parameters
[in]playerPlayer to check.
Returns
Voluntary handicap of the player.

Definition at line 18 of file handicap.qc.

References bound(), and CS_CVAR.

Referenced by Handicap_GetTotalHandicap().

19 {
20  return bound(1.0, CS_CVAR(player).cvar_cl_handicap, 10.0);
21 }
#define CS_CVAR(this)
Definition: state.qh:51
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Handicap_Initialize()

void Handicap_Initialize ( entity  player)

Initializes handicap to its default value.

Parameters
[in,out]playerPlayer to initialize.
Returns
No return.

Definition at line 13 of file handicap.qc.

References CS().

Referenced by ClientConnect().

14 {
15  CS(player).m_handicap = 1;
16 }
ClientState CS(Client this)
Definition: state.qh:47
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Handicap_SetForcedHandicap()

void Handicap_SetForcedHandicap ( entity  player,
float  value 
)

Sets the forced handicap of the player.

Parameters
[in]playerPlayer to alter.
[in]valueHandicap value to set.
Returns
No return.

Definition at line 28 of file handicap.qc.

References CS(), and error().

Referenced by DynamicHandicap_UpdateHandicap().

29 {
30  if (value <= 0)
31  {
32  error("Handicap_SetForcedHandicap: Invalid handicap value.");
33  }
34  CS(player).m_handicap = value;
35 }
ClientState CS(Client this)
Definition: state.qh:47
+ Here is the call graph for this function:
+ Here is the caller graph for this function: