]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Reduce code of FOREACH_CLIENT_RANDOM
authorterencehill <piuntn@gmail.com>
Sun, 10 Feb 2019 17:57:51 +0000 (18:57 +0100)
committerterencehill <piuntn@gmail.com>
Sun, 10 Feb 2019 17:57:51 +0000 (18:57 +0100)
qcsrc/server/utils.qh

index e4dfe2afa4c305e18a15fe644e63a8425dee9364..a37029590a220137294fd26392fd0425550d58d2 100644 (file)
@@ -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; \