Xonotic
|
#include <common/scores.qh>
Go to the source code of this file.
Macros | |
#define | PlayerScore_Get(player, scorefield) PlayerScore_Add(player, scorefield, 0) |
Returns the player's score. More... | |
#define | WINNINGCONDITIONHELPER_LOWERISBETTER_WORST 999999999 |
Functions | |
string | GetPlayerScoreString (entity pl, float shortString) |
Returns score strings for eventlog etc. More... | |
string | GetTeamScoreString (float tm, float shortString) |
float | PlayerScore_Add (entity player, PlayerScoreField scorefield, float score) |
Adds a score to the player's scores. More... | |
void | PlayerScore_Attach (entity player) |
Attaches a PlayerScore entity to a player. More... | |
float | PlayerScore_Clear (entity player) |
Initialize the score of this player if needed. More... | |
void | PlayerScore_Detach (entity player) |
Detaches a PlayerScore entity from the player. More... | |
float | PlayerScore_Set (entity player, PlayerScoreField scorefield, float score) |
Sets the player's score to the score parameter. More... | |
entity | PlayerScore_Sort (.float field, int teams, bool strict, bool nospectators) |
Sorts the players and stores their place in the given field, starting with. More... | |
float | PlayerTeamScore_Add (entity player, PlayerScoreField pscorefield, float tscorefield, float score) |
Adds a score to both the player and the team. More... | |
void | Score_ClearAll () |
Clear ALL scores (for ready-restart). More... | |
void | Score_NicePrint (entity to) |
Prints the scores to the console of a player. More... | |
void | ScoreInfo_Init (float teams) |
Initialize the scores info for the given number of teams. More... | |
void | ScoreInfo_SetLabel_PlayerScore (PlayerScoreField i, string label, float scoreflags) |
Set the label of a player score item, as well as the scoring flags. More... | |
void | ScoreInfo_SetLabel_TeamScore (float i, string label, float scoreflags) |
Set the label of a team score item, as well as the scoring flags. More... | |
float | TeamScore_Add (entity player, float scorefield, float score) |
Adds a score to the player's team's scores. More... | |
float | TeamScore_AddToTeam (int t, float scorefield, float score) |
Adds a score to the given team. More... | |
float | TeamScore_GetCompareValue (float t) |
Returns a value indicating the team score (and higher is better). More... | |
void | WinningConditionHelper (entity this) |
Sets the following results for the current scores entities. More... | |
Variables | |
bool | autocvar_g_full_getstatus_responses |
float | scoreboard_pos |
entity | scores_initialized |
float | WinningConditionHelper_equality |
we have no winner More... | |
float | WinningConditionHelper_lowerisbetter |
lower is better, duh More... | |
entity | WinningConditionHelper_second |
the second player, or NULL if none More... | |
float | WinningConditionHelper_secondscore |
second highest score More... | |
float | WinningConditionHelper_secondteam |
the color of the second team, or -1 if none More... | |
float | WinningConditionHelper_topscore |
highest score More... | |
entity | WinningConditionHelper_winner |
the winning player, or NULL if none More... | |
float | WinningConditionHelper_winnerteam |
the color of the winning team, or -1 if none More... | |
float | WinningConditionHelper_zeroisworst |
zero is worst, duh More... | |
#define PlayerScore_Get | ( | player, | |
scorefield | |||
) | PlayerScore_Add(player, scorefield, 0) |
Returns the player's score.
[in] | player | Player to inspect. |
[in] | scorefield | Field of the score. |
Definition at line 43 of file scores.qh.
Referenced by DynamicHandicap_UpdateHandicap(), MUTATOR_HOOKFUNCTION(), and TeamBalance_GetPlayerForTeamSwitch().
#define WINNINGCONDITIONHELPER_LOWERISBETTER_WORST 999999999 |
Returns score strings for eventlog etc.
When called with NULL, or 0, as argument, they return the labels in the same order. The strings are comma separated; labels that end with !! designate primary, labels that end with ! designate high priority. Labels get an appended < if the scores are better if smaller (e.g. deaths). High priorities always come first. Example label string: score!!,kills,deaths<,suicides< If shortString is set, only the sort keys are returned.
Definition at line 586 of file scores.qc.
References CS(), entity(), FOREACH, ftos(), GetScoreLogLabel(), scorekeeper, scores_flags, scores_label, SFL_SORT_PRIO_MASK, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_SECONDARY, strcat(), strlen(), and substring().
Referenced by DumpStats(), and WinningConditionHelper().
Definition at line 648 of file scores.qc.
References entity(), ftos(), GetScoreLogLabel(), MAX_TEAMSCORE, SFL_SORT_PRIO_MASK, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_SECONDARY, strcat(), strlen(), substring(), teamscorekeepers, teamscores_flags, and teamscores_label.
Referenced by DumpStats(), and WinningConditionHelper().
float PlayerScore_Add | ( | entity | player, |
PlayerScoreField | scorefield, | ||
float | score | ||
) |
Adds a score to the player's scores.
NEVER call this if PlayerScore_Attach has not been called yet! Means: FIXME make players unable to join the game when not called ClientConnect yet. Returns the new score.
Definition at line 336 of file scores.qc.
References BIT, CS(), entity(), LOG_WARN, M_ARGV, MUTATOR_CALLHOOK, scores_initialized, scores_label, strcat(), and warmup_stage.
Referenced by _GameRules_scoring_add(), _GameRules_scoring_add_float2int(), and PlayerTeamScore_Add().
Attaches a PlayerScore entity to a player.
Use that in ClientConnect. Remember to detach it in ClientDisconnect!
Definition at line 318 of file scores.qc.
References CS(), entity(), error(), new_pure, PlayerScore_SendEntity(), and scorekeeper.
Initialize the score of this player if needed.
Does nothing in teamplay. Use that when a spectator becomes a player. Returns whether clearing has been performed
Definition at line 267 of file scores.qc.
References BIT, CS(), entity(), FOREACH, MUTATOR_CALLHOOK, scores_label, and teamscores_entities_count.
Referenced by PutPlayerInServer(), and SetPlayerTeam().
float PlayerScore_Set | ( | entity | player, |
PlayerScoreField | scorefield, | ||
float | score | ||
) |
Sets the player's score to the score parameter.
NEVER call this if PlayerScore_Attach has not been called yet! Means: FIXME make players unable to join the game when not called ClientConnect yet. Returns the new (or old if unchanged) score.
Definition at line 368 of file scores.qc.
References BIT, CS(), entity(), LOG_WARN, scores_initialized, and scores_label.
Referenced by NET_HANDLE().
Sorts the players and stores their place in the given field, starting with.
Definition at line 724 of file scores.qc.
References CS(), entity(), FOREACH_CLIENT, FRAGS_SPECTATOR, NULL, PlayerTeamScore_Compare(), and scorekeeper.
Referenced by MUTATOR_HOOKFUNCTION(), and Score_NicePrint().
float PlayerTeamScore_Add | ( | entity | player, |
PlayerScoreField | pscorefield, | ||
float | tscorefield, | ||
float | score | ||
) |
Adds a score to both the player and the team.
Returns the team score if possible, otherwise the player score.
Definition at line 390 of file scores.qc.
References PlayerScore_Add(), TeamScore_Add(), and teamscores_entities_count.
Referenced by _GameRules_scoring_add_team().
void Score_ClearAll | ( | ) |
Clear ALL scores (for ready-restart).
Definition at line 288 of file scores.qc.
References BIT, CS(), entity(), FOREACH, FOREACH_CLIENTSLOT, MAX_TEAMSCORE, scores_label, teamscorekeepers, and teamscores_label.
Referenced by reset_map().
Prints the scores to the console of a player.
Definition at line 903 of file scores.qc.
References bound(), entity(), floor(), FOREACH, FOREACH_CLIENT, IS_PLAYER, PlayerScore_Sort(), score_dummyfield, Score_NicePrint_Player(), Score_NicePrint_Spectator(), Score_NicePrint_Spectators(), Score_NicePrint_Team(), scores_label, SCORESWIDTH, and teamscores_entities_count.
Referenced by CommonCommand_teamstatus(), and MUTATOR_HOOKFUNCTION().
Initialize the scores info for the given number of teams.
Set all labels right before this call.
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 at line 165 of file scores.qc.
References scores, scores_flags, scores_flags_primary, scores_label, scores_primary, SFL_SORT_PRIO_MASK, SFL_SORT_PRIO_PRIMARY, and strcat().
Referenced by _GameRules_scoring_field(), and ScoreRules_basics().
Set the label of a team score item, as well as the scoring flags.
Definition at line 181 of file scores.qc.
References SFL_SORT_PRIO_MASK, SFL_SORT_PRIO_PRIMARY, strcat(), teamscores, teamscores_flags, teamscores_flags_primary, teamscores_label, and teamscores_primary.
Referenced by _GameRules_scoring_field_team(), and ScoreRules_basics().
Adds a score to the player's team's scores.
NEVER call this if team has not been set yet! Returns the new score.
Definition at line 137 of file scores.qc.
References TeamScore_AddToTeam().
Referenced by PlayerTeamScore_Add().
Adds a score to the given team.
NEVER call this if team has not been set yet! Returns the new score.
Definition at line 108 of file scores.qc.
References BIT, entity(), error(), scores_initialized, teamscorekeepers, and teamscores_label.
Referenced by CA_CheckWinner(), ctf_Handle_Return(), Domination_CheckWinner(), dompointthink(), freezetag_CheckWinner(), GoalTouch(), MUTATOR_HOOKFUNCTION(), Onslaught_CheckWinner(), TeamScore_Add(), WinningCondition_Assault(), and WinningCondition_RanOutOfSpawns().
Returns a value indicating the team score (and higher is better).
Definition at line 783 of file scores.qc.
References entity(), error(), SFL_LOWER_IS_BETTER, SFL_ZERO_IS_WORST, teamscorekeepers, and teamscores_flags_primary.
Referenced by WinningCondition_Scores().
Sets the following results for the current scores entities.
Definition at line 415 of file scores.qc.
References autocvar_g_full_getstatus_responses, autocvar_g_xonoticversion, CS(), cvar_purechanges_count, entity(), FOREACH_CLIENT, ftos(), GetGametype(), GetPlayerScoreString(), GetTeamScoreString(), INGAME_JOINED, IS_PLAYER, IS_REAL_CLIENT, modname, nJoinAllowed(), NULL, player_count, PlayerScore_Compare(), scores_flags_primary, serverflags, SFL_LOWER_IS_BETTER, SFL_ZERO_IS_WORST, strcat(), strcpy, sv_termsofservice_url_escaped, TeamScore_Compare(), teamscorekeepers, teamscores_entities_count, teamscores_flags_primary, WinningConditionHelper_equality, WinningConditionHelper_lowerisbetter, WinningConditionHelper_second, WinningConditionHelper_secondscore, WinningConditionHelper_secondteam, WinningConditionHelper_topscore, WinningConditionHelper_winner, WinningConditionHelper_winnerteam, WinningConditionHelper_zeroisworst, and worldstatus.
Referenced by spawnfunc(), WinningCondition_Assault(), WinningCondition_Invasion(), WinningCondition_LMS(), and WinningCondition_Scores().
bool autocvar_g_full_getstatus_responses |
Definition at line 5 of file scores.qh.
Referenced by WinningConditionHelper().
entity scores_initialized |
Definition at line 7 of file scores.qh.
Referenced by GameplayMode_DelayedInit(), PlayerScore_Add(), PlayerScore_Set(), ScoreInfo_Init(), and TeamScore_AddToTeam().
float WinningConditionHelper_equality |
we have no winner
Definition at line 112 of file scores.qh.
Referenced by WinningCondition_Scores(), and WinningConditionHelper().
float WinningConditionHelper_lowerisbetter |
lower is better, duh
Definition at line 115 of file scores.qh.
Referenced by WinningCondition_Scores(), and WinningConditionHelper().
entity WinningConditionHelper_second |
the second player, or NULL if none
Definition at line 114 of file scores.qh.
Referenced by WinningConditionHelper().
float WinningConditionHelper_secondscore |
second highest score
Definition at line 109 of file scores.qh.
Referenced by WinningCondition_LMS(), WinningCondition_Scores(), and WinningConditionHelper().
float WinningConditionHelper_secondteam |
the color of the second team, or -1 if none
Definition at line 111 of file scores.qh.
Referenced by WinningConditionHelper().
float WinningConditionHelper_topscore |
highest score
Definition at line 108 of file scores.qh.
Referenced by WinningCondition_LMS(), WinningCondition_Scores(), and WinningConditionHelper().
entity WinningConditionHelper_winner |
the winning player, or NULL if none
Definition at line 113 of file scores.qh.
Referenced by WinningCondition_LMS(), WinningCondition_Scores(), and WinningConditionHelper().
float WinningConditionHelper_winnerteam |
the color of the winning team, or -1 if none
Definition at line 110 of file scores.qh.
Referenced by WinningCondition_Scores(), and WinningConditionHelper().
float WinningConditionHelper_zeroisworst |
zero is worst, duh
Definition at line 116 of file scores.qh.
Referenced by WinningCondition_Scores(), and WinningConditionHelper().