]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
assault: always put player in the red team
authorRudolf Polzer <rpolzer@nb-04.(none)>
Thu, 1 Apr 2010 04:59:02 +0000 (06:59 +0200)
committerRudolf Polzer <rpolzer@nb-04.(none)>
Thu, 1 Apr 2010 09:50:00 +0000 (11:50 +0200)
qcsrc/server/teamplay.qc

index 805711a4bc074f35a7a7365a5f7ab9fbb205e093..7d42a533d722b34475eb4a004720ce5eca2b4239 100644 (file)
@@ -625,7 +625,11 @@ void CheckAllowedTeams (entity for_whom)
        c1 = c2 = c3 = c4 = -1;
        cb1 = cb2 = cb3 = cb4 = 0;
 
-       if(g_onslaught)
+       if(g_campaign && pl && clienttype(pl) == CLIENTTYPE_REAL)
+       {
+               c1 = 0; // only allow RED team for player joining
+       }
+       else if(g_onslaught)
        {
                // onslaught is special
                head = findchain(classname, "onslaught_generator");
@@ -800,7 +804,9 @@ float FindSmallestTeam(entity pl, float ignore_pl)
 
        if(totalteams <= 1)
        {
-               if(g_domination)
+               if(g_campaign && pl && clienttype(pl) == CLIENTTYPE_REAL)
+                       return 1; // special case for campaign and player joining
+               else if(g_domination)
                        error("Too few teams available for domination\n");
                else if(g_ctf)
                        error("Too few teams available for ctf\n");
@@ -847,9 +853,9 @@ float FindSmallestTeam(entity pl, float ignore_pl)
        {
                // 1: use team count, if equal prefer own team
                if(c1 >= 0) RandomSelection_Add(world, 1, string_null, 1, (maxc - c1) + (self.team == COLOR_TEAM1) / 512.0);
-               if(c2 >= 0) RandomSelection_Add(world, 1, string_null, 1, (maxc - c1) + (self.team == COLOR_TEAM2) / 512.0);
-               if(c3 >= 0) RandomSelection_Add(world, 1, string_null, 1, (maxc - c1) + (self.team == COLOR_TEAM3) / 512.0);
-               if(c4 >= 0) RandomSelection_Add(world, 1, string_null, 1, (maxc - c1) + (self.team == COLOR_TEAM4) / 512.0);
+               if(c2 >= 0) RandomSelection_Add(world, 2, string_null, 1, (maxc - c1) + (self.team == COLOR_TEAM2) / 512.0);
+               if(c3 >= 0) RandomSelection_Add(world, 3, string_null, 1, (maxc - c1) + (self.team == COLOR_TEAM3) / 512.0);
+               if(c4 >= 0) RandomSelection_Add(world, 4, string_null, 1, (maxc - c1) + (self.team == COLOR_TEAM4) / 512.0);
        }
        else if(balance_type == 3)
        {