From: Mario Date: Fri, 29 May 2020 12:14:47 +0000 (+1000) Subject: Set major and minor groups of stat bits to 16, reduces bandwidth usage X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0e1c4310115e1b3576eb5c1b49ef98c1b9755ac1;p=xonotic%2Fxonotic-data.pk3dir.git Set major and minor groups of stat bits to 16, reduces bandwidth usage --- diff --git a/qcsrc/lib/stats.qh b/qcsrc/lib/stats.qh index 6ee807979..4af733b66 100644 --- a/qcsrc/lib/stats.qh +++ b/qcsrc/lib/stats.qh @@ -100,8 +100,8 @@ REGISTRY_DEFINE_GET(Stats, NULL) REGISTER_NET_LINKED(ENT_CLIENT_STATS) -const int Stats_groups_minor = 12; -const int Stats_groups_major = 22; // ceil(REGISTRY_MAX(Stats) / Stats_groups_minor) +const int Stats_groups_minor = 16; +const int Stats_groups_major = 16; // ceil(REGISTRY_MAX(Stats) / Stats_groups_minor) #define G_MAJOR(id) (floor((id) / Stats_groups_minor)) #define G_MINOR(id) ((id) % Stats_groups_minor) @@ -111,12 +111,12 @@ const int Stats_groups_major = 22; // ceil(REGISTRY_MAX(Stats) / Stats_groups_mi NET_HANDLE(ENT_CLIENT_STATS, bool isnew) { make_pure(this); - const int majorBits = ReadInt24_t(); + const int majorBits = ReadShort(); for (int i = 0; i < Stats_groups_major; ++i) { if (!(majorBits & BIT(i))) { continue; } - const int minorBits = ReadInt24_t(); + const int minorBits = ReadShort(); for (int j = 0; j < Stats_groups_minor; ++j) { if (!(minorBits & BIT(j))) { continue; @@ -152,7 +152,7 @@ void Stats_Write(entity data) statsminorBitsArr[maj] = BITSET(statsminorBitsArr[maj], BIT(G_MINOR(it.m_id)), true); } }); - WriteInt24_t(MSG_ENTITY, majorBits); + WriteShort(MSG_ENTITY, majorBits); for (int i = 0; i < Stats_groups_major; ++i) { @@ -160,7 +160,7 @@ void Stats_Write(entity data) continue; const int minorBits = statsminorBitsArr[i]; - WriteInt24_t(MSG_ENTITY, minorBits); + WriteShort(MSG_ENTITY, minorBits); for (int j = 0; j < Stats_groups_minor; ++j) { if (!(minorBits & BIT(j)))