5 #define REGISTER_SP(id) REGISTER(Scores, SP, id, m_id, new_pure(PlayerScoreField))
6 REGISTRY(Scores, MAX_SCORE);
7 REGISTER_REGISTRY(Scores)
9 REGISTRY_CHECK(Scores);
11 REGISTRY_DEFINE_GET(Scores, NULL)
12 STATIC_INIT(Scores_renumber) { FOREACH(Scores, true, it.m_id = i); }
19 // fields not networked via the score system
25 REGISTER_SP(SEPARATOR);
27 REGISTER_SP(KDRATIO); // kills / deaths
28 REGISTER_SP(SUM); // kills - deaths
29 REGISTER_SP(FRAGS); // kills - suicides
36 REGISTER_SP(DMGTAKEN);
40 REGISTER_SP(SUICIDES);
41 REGISTER_SP(TEAMKILLS);
47 // TODO: move to common mutators
49 REGISTER_SP(RACE_TIME);
50 REGISTER_SP(RACE_LAPS);
51 REGISTER_SP(RACE_FASTEST);
53 //REGISTER_SP(CTS_TIME);
54 //REGISTER_SP(CTS_LAPS);
55 //REGISTER_SP(CTS_FASTEST);
57 REGISTER_SP(ASSAULT_OBJECTIVES);
59 REGISTER_SP(CTF_PICKUPS);
60 REGISTER_SP(CTF_FCKILLS);
61 REGISTER_SP(CTF_RETURNS);
62 REGISTER_SP(CTF_CAPS);
63 REGISTER_SP(CTF_CAPTIME);
64 REGISTER_SP(CTF_DROPS);
66 REGISTER_SP(DOM_TAKES);
67 REGISTER_SP(DOM_TICKS);
69 REGISTER_SP(FREEZETAG_REVIVALS);
71 REGISTER_SP(KEEPAWAY_PICKUPS);
72 REGISTER_SP(KEEPAWAY_BCTIME);
73 REGISTER_SP(KEEPAWAY_CARRIERKILLS);
75 REGISTER_SP(KH_PICKUPS);
77 REGISTER_SP(KH_KCKILLS);
78 REGISTER_SP(KH_PUSHES);
79 REGISTER_SP(KH_DESTROYS);
80 REGISTER_SP(KH_LOSSES);
82 REGISTER_SP(LMS_RANK);
83 REGISTER_SP(LMS_LIVES);
85 REGISTER_SP(NEXBALL_GOALS);
86 REGISTER_SP(NEXBALL_FAULTS);
88 REGISTER_SP(ONS_TAKES);
89 REGISTER_SP(ONS_CAPS);
93 // the stuff you don't need to see
96 * Lower scores are better (e.g. suicides)
98 const int SFL_LOWER_IS_BETTER = BIT(0);
101 * Don't show zero values as scores
103 const int SFL_HIDE_ZERO = BIT(1);
106 * Allow a column to be hidden (do not automatically add it even if it is a sorting key)
108 const int SFL_ALLOW_HIDE = BIT(4);
111 * Display as a rank (with st, nd, rd, th suffix)
113 const int SFL_RANK = BIT(5);
116 * Display as mm:ss.s, value is stored as 10ths of a second (AND 0 is the worst possible value!)
118 const int SFL_TIME = BIT(6);
120 const int SFL_NOT_SORTABLE = BIT(7); // don't sort by this field
122 // not an extra constant yet
123 #define SFL_ZERO_IS_WORST SFL_TIME
126 * Scoring priority (NOTE: PRIMARY is used for fraglimit)
128 const int SFL_SORT_PRIO_SECONDARY = BIT(2);
129 const int SFL_SORT_PRIO_PRIMARY = BIT(3);
130 const int SFL_SORT_PRIO_MASK = SFL_SORT_PRIO_PRIMARY | SFL_SORT_PRIO_SECONDARY;
132 #define IS_INCREASING(x) ( (x) & SFL_LOWER_IS_BETTER )
133 #define IS_DECREASING(x) ( !((x) & SFL_LOWER_IS_BETTER) )
135 USING(PlayerScoreField, entity);
136 .int _scores[MAX_SCORE];
140 #define scores(this) _scores[(this).m_id]
141 #define scores_label(this) ((this).m_name)
142 #define scores_flags(this) ((this).m_flags)
144 #define MAX_TEAMSCORE 2
145 USING(ScoreTeam, string);
146 .int _teamscores[MAX_TEAMSCORE];
147 #define teamscores(i) _teamscores[i]
148 string _teamscores_label[MAX_TEAMSCORE];
149 #define teamscores_label(i) _teamscores_label[i]
150 int _teamscores_flags[MAX_TEAMSCORE];
151 #define teamscores_flags(i) _teamscores_flags[i]
153 const int ST_SCORE = 0;