From: terencehill Date: Sun, 10 Feb 2019 17:57:51 +0000 (+0100) Subject: Reduce code of FOREACH_CLIENT_RANDOM X-Git-Tag: xonotic-v0.8.5~1604^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=75c14fb708f20c0838d3af82507a25430708ec1c;p=xonotic%2Fxonotic-data.pk3dir.git Reduce code of FOREACH_CLIENT_RANDOM --- diff --git a/qcsrc/server/utils.qh b/qcsrc/server/utils.qh index e4dfe2afa..a37029590 100644 --- a/qcsrc/server/utils.qh +++ b/qcsrc/server/utils.qh @@ -55,18 +55,12 @@ bool _FCR_entered = false; _FCR_entered = true; \ int _cnt = 0; \ FOREACH_CLIENT(cond, { \ - int _j = floor(random() * (_cnt + 1)); \ - if (_j == _cnt) \ - { \ - _FCR_clients[_cnt] = it; \ - } \ - else \ - { \ - _FCR_clients[_cnt] = _FCR_clients[_j]; \ - _FCR_clients[_j] = it; \ - } \ - _cnt++; \ - }); \ + int _j = floor(random() * (_cnt + 1)); \ + if (_j != _cnt) \ + _FCR_clients[_cnt] = _FCR_clients[_j]; \ + _FCR_clients[_j] = it; \ + ++_cnt; \ + }); \ for (int _i = 0; _i < _cnt; ++_i) \ { \ const noref int i = _i; \