REGISTRY(Notifications, BITS(11))
REGISTER_REGISTRY(Notifications)
-REGISTRY_SORT(Notifications);
+REGISTRY_SORT(Notifications)
REGISTRY_DEFINE_GET(Notifications, NULL)
STATIC_INIT(Notifications) { FOREACH(Notifications, true, it.m_id = i); }
#define MAX_SCORE 64
#define REGISTER_SP(id) REGISTER(Scores, SP, id, m_id, new_pure(PlayerScoreField))
-REGISTRY(Scores, MAX_SCORE);
+REGISTRY(Scores, MAX_SCORE)
REGISTER_REGISTRY(Scores)
// do not sort alphabetically, player sort priority is based on score registration order
-//REGISTRY_SORT(Scores);
-REGISTRY_CHECK(Scores);
+//REGISTRY_SORT(Scores)
+REGISTRY_CHECK(Scores)
REGISTRY_DEFINE_GET(Scores, NULL)
STATIC_INIT(Scores_renumber) { FOREACH(Scores, true, it.m_id = i); }
STATIC_INIT(Registry_check_##id) \
{ \
/* Note: SHA256 isn't always available, use MD4 instead */ \
- string s = ""; \
- FOREACH(id, true, s = strcat(s, ":", it.registered_id)); \
+ string s = "", group = ""; \
+ int str_len = 0, digests_len = 0, group_idx = 0; \
+ FOREACH(id, true, { \
+ group = strcat(group, ":", it.registered_id); \
+ if (++group_idx < 50) /* this is to reduce strlen calls */ \
+ continue; \
+ int group_len = strlen(group); \
+ if (str_len + 1 + group_len >= 16383) /* exceeding max string length? */ \
+ { \
+ /* keep previous digests and replace current string with its digest */ \
+ s = strcat(substring(s, 0, digests_len), ":", digest_hex("MD4", s)); \
+ digests_len = str_len = strlen(s); \
+ } \
+ s = strcat(s, group); \
+ str_len += group_len; \
+ group = ""; \
+ group_idx = 0; \
+ }); \
+ s = strcat(s, group); \
s = substring(s, 1, -1); /* remove initial ":" */ \
string h = REGISTRY_HASH(id) = strzone(digest_hex("MD4", s)); \
LOG_DEBUGF(#id ": %s\n[%s]", h, s); \
} \
- void Registry_check(string r, string sv) \
+ void Registry_check(string r, string sv) /* called by CSQC */ \
{ \
if (r == #id) \
{ \
} \
} \
} \
- void Registry_send_all() { Registry_send(#id, REGISTRY_HASH(id)); } \
+ void Registry_send_all() { Registry_send(#id, REGISTRY_HASH(id)); } /* called by SVQC */ \
#define _REGISTER_REGISTRY(id, str) \
ACCUMULATE_FUNCTION(__static_init_1, Register##id) \