From 23b58d7bd9224487ac0a8d111a609bbd56e149c7 Mon Sep 17 00:00:00 2001 From: terencehill Date: Thu, 24 Aug 2017 19:34:48 +0200 Subject: [PATCH] More BITs --- qcsrc/client/main.qc | 8 ++++---- qcsrc/server/client.qc | 14 ++++++-------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index adc2ae7bd..7ad10879f 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -496,9 +496,9 @@ NET_HANDLE(ENT_CLIENT_CLIENTDATA, bool isnew) int f = ReadByte(); - scoreboard_showscores_force = (f & 1); + scoreboard_showscores_force = (f & BIT(0)); - if(f & 2) + if(f & BIT(1)) { newspectatee_status = ReadByte(); if(newspectatee_status == player_localnum + 1) @@ -507,9 +507,9 @@ NET_HANDLE(ENT_CLIENT_CLIENTDATA, bool isnew) else newspectatee_status = 0; - spectatorbutton_zoom = (f & 4); + spectatorbutton_zoom = (f & BIT(2)); - if(f & 16) + if(f & BIT(4)) { num_spectators = ReadByte(); diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index b0eb75ae4..db0e47820 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -113,20 +113,18 @@ bool ClientData_Send(entity this, entity to, int sf) if (IS_SPEC(e)) e = e.enemy; sf = 0; - if (CS(e).race_completed) sf |= 1; // forced scoreboard - if (CS(to).spectatee_status) sf |= 2; // spectator ent number follows - if (CS(e).zoomstate) sf |= 4; // zoomed - if (autocvar_sv_showspectators) sf |= 16; // show spectators + if (CS(e).race_completed) sf |= BIT(0); // forced scoreboard + if (CS(to).spectatee_status) sf |= BIT(1); // spectator ent number follows + if (CS(e).zoomstate) sf |= BIT(2); // zoomed + if (autocvar_sv_showspectators) sf |= BIT(4); // show spectators WriteHeader(MSG_ENTITY, ENT_CLIENT_CLIENTDATA); WriteByte(MSG_ENTITY, sf); - if (sf & 2) - { + if (sf & BIT(1)) WriteByte(MSG_ENTITY, CS(to).spectatee_status); - } - if(sf & 16) + if(sf & BIT(4)) { float specs = CountSpectators(e, to); WriteByte(MSG_ENTITY, specs); -- 2.39.2