]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
don't shuffle when teams are forced
authorMartin Taibr <taibr.martin@gmail.com>
Sat, 26 Nov 2016 19:34:46 +0000 (20:34 +0100)
committerMartin Taibr <taibr.martin@gmail.com>
Sat, 26 Nov 2016 19:34:46 +0000 (20:34 +0100)
qcsrc/server/command/sv_cmd.qc

index b9ac09f1960d2bbcc0eb65248ef59147fe5d5fc3..f99ed23b25240463a3960e496fd0e6542d00c8ac 100644 (file)
@@ -1331,6 +1331,16 @@ void GameCommand_shuffleteams(float request)
                                return;
                        }
 
+                       FOREACH_CLIENT(IS_PLAYER(it) || it.caplayer, LAMBDA(
+                               if (it.team_forced) {
+                                       // we could theoretically assign forced players to their teams
+                                       // and shuffle the rest to fill the empty spots but in practise
+                                       // either all players or none are gonna have forced teams
+                                       LOG_INFO("Can't shuffle teams because at least one player has a forced team.\n");
+                                       return;
+                               }
+                       ));
+
                        int number_of_teams = 0;
                        CheckAllowedTeams(NULL);
                        if (c1 >= 0) number_of_teams = max(1, number_of_teams);