]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/scores_rules.qc
Merge branch 'master' into bones_was_here/q3compat
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / scores_rules.qc
index 160b5df5e4cfb21c279b96c39d28dbe6965b27d4..c7c9c3e8d74ed5e61f2747d37683d84ad99e9363 100644 (file)
@@ -1,11 +1,11 @@
 #include "scores_rules.qh"
 
-#include <server/defs.qh>
-#include <server/miscfunctions.qh>
-#include "client.qh"
-#include "scores.qh"
 #include <common/gamemodes/rules.qh>
-#include "teamplay.qh"
+#include <common/stats.qh>
+#include <common/weapons/_all.qh>
+#include <server/client.qh>
+#include <server/scores.qh>
+#include <server/teamplay.qh>
 
 int ScoreRules_teams;
 
@@ -17,8 +17,6 @@ int NumTeams(int teams)
 int AvailableTeams()
 {
        return NumTeams(ScoreRules_teams);
-       // NOTE: this method is unreliable, as forced teams set the c* globals to weird values
-       //return boolean(c1 >= 0) + boolean(c2 >= 0) + boolean(c3 >= 0) + boolean(c4 >= 0);
 }
 
 // NOTE: ST_constants may not be >= MAX_TEAMSCORE
@@ -64,12 +62,11 @@ void ScoreRules_basics_end()
 void ScoreRules_generic()
 {
     int teams = 0;
-       if (teamplay) {
-               CheckAllowedTeams(NULL);
-               if (c1 >= 0) teams |= BIT(0);
-               if (c2 >= 0) teams |= BIT(1);
-               if (c3 >= 0) teams |= BIT(2);
-               if (c4 >= 0) teams |= BIT(3);
+       if (teamplay)
+       {
+               entity balance = TeamBalance_CheckAllowedTeams(NULL);
+               teams = TeamBalance_GetAllowedTeams(balance);
+               TeamBalance_Destroy(balance);
        }
        GameRules_scoring(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, {});
 }