From: Samual Date: Thu, 10 Nov 2011 20:48:20 +0000 (-0500) Subject: Make shuffleteams ACTUALLY work randomly ^_^ X-Git-Tag: xonotic-v0.6.0~188^2~28^2~221 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=48153b123df254395fab67c7536aab9a1a76e830;p=xonotic%2Fxonotic-data.pk3dir.git Make shuffleteams ACTUALLY work randomly ^_^ --- diff --git a/qcsrc/server/gamecommand.qc b/qcsrc/server/gamecommand.qc index 26def9e87..e26b4e3cb 100644 --- a/qcsrc/server/gamecommand.qc +++ b/qcsrc/server/gamecommand.qc @@ -1470,24 +1470,28 @@ void GameCommand_shuffleteams(float request) // sort through the random list of players made earlier for(z = 1; z <= maxclients; ++z) - { - if(shuffleteams_teams[i] >= x) - break; // move on to next team - - if not(shuffleteams_players[z]) - continue; // not a player, move on to next random slot - - self = edict_num(shuffleteams_players[z]); // TODO: add sanity checks for this entity to make sure it's okay and not some error. - if(self.team != team_color) + { + if not(shuffleteams_teams[i] >= x) { - MoveToTeam(self, team_color, 6, 0); + if not(shuffleteams_players[z]) + continue; // not a player, move on to next random slot + + self = edict_num(shuffleteams_players[z]); // TODO: add sanity checks for this entity to make sure it's okay and not some error. + + if(self.team != team_color) + MoveToTeam(self, team_color, 6, 0); + shuffleteams_players[z] = 0; shuffleteams_teams[i] = shuffleteams_teams[i] + 1; } + else + { + break; // move on to next team + } } } - print("Successfully shuffled the players around randomly.\n"); + bprint("Successfully shuffled the players around randomly.\n"); // clear the buffers now for (i=0; i