Xonotic
scores_rules.qc File Reference
+ Include dependency graph for scores_rules.qc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int AvailableTeams ()
 
bool IsTeamAvailable (int team_num)
 
int NumTeams (int teams)
 
void ScoreRules_basics (int teams, float sprio, float stprio, float score_enabled)
 
void ScoreRules_basics_end ()
 
void ScoreRules_generic ()
 

Variables

int ScoreRules_teams
 

Function Documentation

◆ AvailableTeams()

int AvailableTeams ( )

Definition at line 22 of file scores_rules.qc.

References NumTeams(), and ScoreRules_teams.

Referenced by bot_fixcount(), bot_setnameandstuff(), ClientConnect(), MapHasRightSize(), and TeamBalance_CheckAllowedTeams().

23 {
24  return NumTeams(ScoreRules_teams);
25 }
int NumTeams(int teams)
Definition: scores_rules.qc:17
int ScoreRules_teams
Definition: scores_rules.qc:10
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsTeamAvailable()

bool IsTeamAvailable ( int  team_num)

Definition at line 12 of file scores_rules.qc.

References boolean, ScoreRules_teams, and Team_TeamToBit().

Referenced by GameCommand_moveplayer().

13 {
14  return boolean(ScoreRules_teams & Team_TeamToBit(team_num));
15 }
int ScoreRules_teams
Definition: scores_rules.qc:10
#define boolean(value)
Definition: bool.qh:9
int Team_TeamToBit(int team_num)
Converts team value into bit value that is used in team bitmasks.
Definition: teams.qh:199
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NumTeams()

int NumTeams ( int  teams)

Definition at line 17 of file scores_rules.qc.

References BIT, and boolean.

Referenced by AvailableTeams(), CA_CheckTeams(), ctf_DelayedInit(), freezetag_CheckTeams(), GoalTouch(), kh_GetMissingTeams(), kh_Key_AllOwnedByWhichTeam(), kh_LoserTeam(), kh_StartRound(), and kh_WinnerTeam().

18 {
19  return boolean(teams & BIT(0)) + boolean(teams & BIT(1)) + boolean(teams & BIT(2)) + boolean(teams & BIT(3));
20 }
entity teams
Definition: main.qh:44
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition: bits.qh:8
#define boolean(value)
Definition: bool.qh:9
+ Here is the caller graph for this function:

◆ ScoreRules_basics()

void ScoreRules_basics ( int  teams,
float  sprio,
float  stprio,
float  score_enabled 
)

Definition at line 29 of file scores_rules.qc.

References FOREACH, INDEPENDENT_PLAYERS, MAX_TEAMSCORE, ScoreInfo_SetLabel_PlayerScore(), ScoreInfo_SetLabel_TeamScore(), ScoreRules_teams, SFL_LOWER_IS_BETTER, ST_SCORE, and teams.

Referenced by _GameRules_scoring_begin().

30 {
31  FOREACH(Scores, true, {
33  });
34  for(int i = 0; i < MAX_TEAMSCORE; ++i)
36 
38 
39  if(score_enabled)
40  ScoreInfo_SetLabel_TeamScore(ST_SCORE, "score", stprio);
41 
43  ScoreInfo_SetLabel_PlayerScore(SP_KILLS, "kills", 0);
44 
46 
48  {
49  ScoreInfo_SetLabel_PlayerScore(SP_SUICIDES, "suicides", SFL_LOWER_IS_BETTER);
50  ScoreInfo_SetLabel_PlayerScore(SP_TEAMKILLS, "teamkills", SFL_LOWER_IS_BETTER);
51  }
52 
53  if(score_enabled)
54  ScoreInfo_SetLabel_PlayerScore(SP_SCORE, "score", sprio);
55 
56  ScoreInfo_SetLabel_PlayerScore(SP_DMG, "dmg", 0);
57  ScoreInfo_SetLabel_PlayerScore(SP_DMGTAKEN, "dmgtaken", SFL_LOWER_IS_BETTER);
58  ScoreInfo_SetLabel_PlayerScore(SP_ELO, "elo", 0);
59 
60  if(STAT(SHOWFPS))
61  ScoreInfo_SetLabel_PlayerScore(SP_FPS, "fps", 0);
62 }
const int ST_SCORE
Definition: scores.qh:151
void ScoreInfo_SetLabel_PlayerScore(PlayerScoreField i, string label, float scoreflags)
Set the label of a player score item, as well as the scoring flags.
Definition: scores.qc:165
#define INDEPENDENT_PLAYERS
Definition: client.qh:313
const int SFL_LOWER_IS_BETTER
Lower scores are better (e.g.
Definition: scores.qh:98
entity teams
Definition: main.qh:44
#define MAX_TEAMSCORE
Definition: scores.qh:142
void ScoreInfo_SetLabel_TeamScore(float i, string label, float scoreflags)
Set the label of a team score item, as well as the scoring flags.
Definition: scores.qc:181
int ScoreRules_teams
Definition: scores_rules.qc:10
#define FOREACH(list, cond, body)
Definition: iter.qh:19
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ScoreRules_basics_end()

void ScoreRules_basics_end ( )

Definition at line 64 of file scores_rules.qc.

References ScoreInfo_Init(), and ScoreRules_teams.

Referenced by _GameRules_scoring_end().

65 {
67 }
void ScoreInfo_Init(int teams)
Definition: scores.qc:214
int ScoreRules_teams
Definition: scores_rules.qc:10
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ScoreRules_generic()

void ScoreRules_generic ( )

Definition at line 69 of file scores_rules.qc.

References entity(), GameRules_scoring, NULL, SFL_SORT_PRIO_PRIMARY, TeamBalance_CheckAllowedTeams(), TeamBalance_Destroy(), TeamBalance_GetAllowedTeams(), teamplay, and teams.

Referenced by GameplayMode_DelayedInit().

70 {
71  int teams = 0;
72  if (teamplay)
73  {
75  teams = TeamBalance_GetAllowedTeams(balance);
76  TeamBalance_Destroy(balance);
77  }
79 }
#define GameRules_scoring(teams, spprio, stprio, fields)
Definition: sv_rules.qh:53
void TeamBalance_Destroy(entity balance)
Destroy the team balance entity.
Definition: teamplay.qc:627
entity() spawn
const int SFL_SORT_PRIO_PRIMARY
Definition: scores.qh:127
entity teams
Definition: main.qh:44
int TeamBalance_GetAllowedTeams(entity balance)
Returns the bitmask of allowed teams.
Definition: teamplay.qc:640
#define NULL
Definition: post.qh:17
float teamplay
Definition: progsdefs.qc:31
entity TeamBalance_CheckAllowedTeams(entity for_whom)
Checks whether the player can join teams according to global configuration and mutator settings...
Definition: teamplay.qc:487
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ ScoreRules_teams

int ScoreRules_teams