]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/mutator/gamemode_ca.qh
GameRules: simplify assigning teams bitmask
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator / gamemode_ca.qh
index 6d4786ee529acbf5d78cb70dc459acfde7e4cd0d..5a4a9f8438ead67bbb81d9a0d47e73f5ac9c72ee 100644 (file)
@@ -33,17 +33,9 @@ REGISTER_MUTATOR(ca, false)
                ca_teams = autocvar_g_ca_teams_override;
                if (ca_teams < 2)
                        ca_teams = cvar("g_ca_teams"); // read the cvar directly as it gets written earlier in the same frame
-               ca_teams = bound(2, ca_teams, 4);
 
-               int teams = 0;
-               if(ca_teams >= 1) teams |= BIT(0);
-               if(ca_teams >= 2) teams |= BIT(1);
-               if(ca_teams >= 3) teams |= BIT(2);
-               if(ca_teams >= 4) teams |= BIT(3);
-
-               ca_teams = teams; // now set it?
-
-        GameRules_scoring(teams, SFL_SORT_PRIO_PRIMARY, 0, {
+               ca_teams = BITS(bound(2, ca_teams, 4));
+        GameRules_scoring(ca_teams, SFL_SORT_PRIO_PRIMARY, 0, {
             field_team(ST_CA_ROUNDS, "rounds", SFL_SORT_PRIO_PRIMARY);
         });