35 if (t1.(field) == t2.(field))
45 else if (t2.(field) == 0)
53 previous = (t2.(field) - t1.(field));
55 previous = (t1.(field) - t2.(field));
69 int t = this.
team - 1;
86 if(sendflags &
BIT(i))
88 if(longflags &
BIT(i))
116 if(t <= 0 || t >= 16)
120 error(
"Adding score to invalid team!");
127 error(
"Adding score to unknown team!");
131 s.SendFlags |=
BIT(scorefield);
132 return (s.(teamscores(scorefield)) += score);
143 if(!t1 || !t2)
return (!t2) - !t1;
147 error(
"MAX_TEAMSCORE > 2 not supported");
153 if (
result == 0 && strict)
158 result = t1.team - t2.team;
225 bool welcome_msg_too = (!
CS(to) ||
time <
CS(to).jointime + 5);
266 if (this.(
scores(it)) > 127 || this.(
scores(it)) <= -128)
295 sk.SendFlags |=
BIT(i % 16);
296 if(i != SP_SKILL.m_id)
308 sk =
CS(it).scorekeeper;
312 sk.SendFlags |=
BIT(i % 16);
313 if(i != SP_SKILL.m_id)
317 for(t = 0; t < 16; ++t)
325 sk.SendFlags |=
BIT(j);
326 sk.(teamscores(j)) = 0;
334 error(
"player already has a scorekeeper");
338 CS(player).scorekeeper = sk;
344 error(
"player has no scorekeeper");
345 delete(
CS(player).scorekeeper);
346 CS(player).scorekeeper =
NULL;
351 bool mutator_returnvalue =
MUTATOR_CALLHOOK(AddPlayerScore, scorefield, score, player);
365 LOG_WARN(
"Adding score to unknown player!");
370 return s.(scores(scorefield));
373 s.SendFlags |=
BIT(scorefield.m_id % 16);
376 s.(scores(scorefield)) += score;
378 return s.(scores(scorefield));
389 LOG_WARN(
"Setting score of unknown player!");
393 float oldscore = s.(scores(scorefield));
394 if(oldscore == score)
398 s.SendFlags |=
BIT(scorefield.m_id % 16);
399 s.(scores(scorefield)) = score;
400 return s.(scores(scorefield));
414 if(!t1 || !t2)
return (!t2) - !t1;
422 if (
result == 0 && strict)
429 var .float f =
scores(it);
434 result = t1.owner.playerid - t2.owner.playerid;
472 for(t = 0; t < 16; ++t)
478 for(t = 0; t < 16; ++t)
486 secondscorekeeper = winnerscorekeeper;
487 winnerscorekeeper = sk;
495 secondscorekeeper = sk;
517 sk =
CS(it).scorekeeper;
523 secondscorekeeper = winnerscorekeeper;
524 winnerscorekeeper = sk;
532 secondscorekeeper = sk;
584 s =
strcat(s,
":spectator");
594 if (s != it.clientstatus)
595 strcpy(it.clientstatus, s);
602 label =
strcat(label,
"<");
604 label =
strcat(label,
"!!");
606 label =
strcat(label,
"!");
653 out =
strcat(out,
ftos(sk.(scores(it))),
",");
658 out =
strcat(out,
ftos(sk.(scores(it))),
",");
664 out =
strcat(out,
ftos(sk.(scores(it))),
",");
711 out =
strcat(out,
ftos(sk.(teamscores(i))),
",");
715 out =
strcat(out,
ftos(sk.(teamscores(i))),
",");
720 out =
strcat(out,
ftos(sk.(teamscores(i))),
",");
731 if(p1.team != p2.team)
747 entity p, plist, pprev, pbest, pbestprev, pfirst, plast;
764 pfirst = plast =
NULL;
769 pprev = pbestprev =
NULL;
771 for(p = plist; (pprev = p), (p = p.chain); )
781 if(pbestprev ==
NULL)
784 pbestprev.chain = pbest.chain;
807 if(t <= 0 || t >= 16)
811 error(
"Reading score of invalid team!");
817 s = sk.teamscores_primary;
852 float sc = sk.(teamscores(i));
886 s =
strcat(s, strpad(i,
""));
895 float sc = sk.(scores(it));
959 for (
int t = 0; t < 16; ++t)
#define MUTATOR_CALLHOOK(id,...)
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define scores_label(this)
const int SFL_LOWER_IS_BETTER
Lower scores are better (e.g.
#define teamscores_flags(i)
#define teamscores_label(i)
#define scores_flags(this)
const int SFL_NOT_SORTABLE
const int SFL_SORT_PRIO_MASK
const int SFL_SORT_PRIO_SECONDARY
Scoring priority (NOTE: PRIMARY is used for fraglimit) NOTE: SFL_SORT_PRIO_SECONDARY value must be lo...
#define SFL_ZERO_IS_WORST
const int SFL_SORT_PRIO_PRIMARY
string playername(string thename, int teamid, bool team_colorize)
string ScoreString(int pFlags, float pValue, int rounds_played)
const int FRAGS_SPECTATOR
#define FOREACH(list, cond, body)
#define WriteHeader(to, id)
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
#define WriteRegistered(r, to, it)
Gametype MapInfo_LoadedGametype
spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2 f1points s1 s2
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
#define new_pure(class)
purely logical entities (not linked to the area grid)
void PlayerStats_GameReport_AddTeam(int t)
void PlayerStats_GameReport_AddEvent(string event_id)
#define PlayerStats_GameReport_Event_Team(team, eventid, val)
const string PLAYERSTATS_SCOREBOARD
const string PLAYERSTATS_TOTAL
#define PlayerStats_GameReport_Event_Player(ent, eventid, val)
void Score_NicePrint_Team(entity to, float t, float w)
string Score_NicePrint_ItemColor(int vflags)
int ScoreField_Compare(entity t1, entity t2,.float field, int fieldflags, int previous)
void PlayerScore_Detach(entity player)
Detaches a PlayerScore entity from the player.
entity teamscorekeepers[16]
string GetTeamScoreString(int tm, float shortString)
int scores_flags_secondary
float TeamScore_Add(entity player, float scorefield, float score)
Adds a score to the player's team's scores.
var int teamscores_primary
float TeamScore_GetCompareValue(float t)
Returns a value indicating the team score (and higher is better).
void WinningConditionHelper(entity this)
Sets the following results for the current scores entities.
void ScoreInfo_Init(int teams)
Initialize the scores info for the given number of teams.
string GetScoreLogLabel(string label, float fl)
void Score_ClearAll()
Clear ALL scores (for ready-restart).
void TeamScore_Spawn(float t, string name)
int teamscores_flags_primary
void Score_NicePrint_Spectator(entity to, entity p)
float TeamScore_AddToTeam(int t, float scorefield, float score)
Adds a score to the given team.
int teamscores_entities_count
void ScoreInfo_SetLabel_TeamScore(int i, string label, int scoreflags)
bool ScoreInfo_SendEntity(entity this, entity to, int sf)
float PlayerScore_Compare(entity t1, entity t2, bool strict)
void PlayerScore_PlayerStats(entity p)
float PlayerTeamScore_Add(entity player, PlayerScoreField pscorefield, float tscorefield, float score)
Adds a score to both the player and the team.
void Score_NicePrint_Player(entity to, entity p, float w)
int PlayerTeamScore_Compare(entity p1, entity p2, float teams, bool strict)
void PlayerScore_Attach(entity player)
Attaches a PlayerScore entity to a player.
void Score_NicePrint(entity to)
Prints the scores to the console of a player.
bool PlayerScore_SendEntity(entity this, entity to, float sendflags)
int TeamScore_Compare(entity t1, entity t2, bool strict)
void Score_NicePrint_Spectators(entity to)
string GetPlayerScoreString(entity pl, float shortString)
Returns score strings for eventlog etc.
entity PlayerScore_Sort(.float field, int teams, bool strict, bool nospectators)
Sorts the players and stores their place in the given field, starting with.
void ScoreInfo_SetLabel_PlayerScore(PlayerScoreField i, string label, int scoreflags)
float PlayerScore_Add(entity player, PlayerScoreField scorefield, float score)
Adds a score to the player's scores.
bool TeamScore_SendEntity(entity this, entity to, float sendflags)
int autocvar_g_score_resetonjoin
float PlayerScore_Set(entity player, PlayerScoreField scorefield, float score)
Sets the player's score to the score parameter.
bool PlayerScore_Clear(entity player)
Initialize the score of this player if needed.
void PlayerScore_TeamStats()
void SendWelcomeMessage(entity this, int msg_type)
int nJoinAllowed(entity this)
Determines how many player slots are free.
string autocvar_g_xonoticversion
void print_to(entity to, string input)
float WinningConditionHelper_secondscore
second highest score
entity WinningConditionHelper_second
the second player, or NULL if none
entity scores_initialized
float WinningConditionHelper_winnerteam
the color of the winning team, or -1 if none
entity WinningConditionHelper_winner
the winning player, or NULL if none
float WinningConditionHelper_topscore
highest score
float WinningConditionHelper_equality
we have no winner
bool autocvar_g_full_getstatus_responses
float WinningConditionHelper_lowerisbetter
lower is better, duh
float WinningConditionHelper_zeroisworst
zero is worst, duh
float WinningConditionHelper_secondteam
the color of the second team, or -1 if none
ClientState CS(Client this)
#define INGAME_JOINED(it)
#define Team_ColoredFullName(teamid)
#define IS_REAL_CLIENT(v)
#define FOREACH_CLIENT(cond, body)
#define FOREACH_CLIENTSLOT(cond, body)
string loaded_gametype_custom_string
float cvar_purechanges_count
string sv_termsofservice_url_escaped