]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/command/sv_cmd.qc
Merge branch 'terencehill/minplayers_per_team' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / sv_cmd.qc
index c917874c358f5d345cd740fcffa194033f9f54c7..5dc92eb90400484f375ad60ee8c98b38c254c2c8 100644 (file)
@@ -330,6 +330,7 @@ void GameCommand_bot_cmd(int request, int argc, string command)
                        {
                                cvar_settemp("bot_vs_human", "0");
                                cvar_settemp("minplayers", "0");
+                               cvar_settemp("minplayers_per_team", "0");
                                cvar_settemp("bot_number", "0");
                                bot_fixcount();
                                cvar_settemp("bot_number", argv(2));
@@ -362,6 +363,7 @@ void GameCommand_bot_cmd(int request, int argc, string command)
                                                {
                                                        cvar_settemp("bot_vs_human", "0");
                                                        cvar_settemp("minplayers", "0");
+                                                       cvar_settemp("minplayers_per_team", "0");
                                                        cvar_settemp("bot_number", "0");
                                                        bot_fixcount();
                                                        cvar_settemp("bot_number", argv(3));
@@ -1052,8 +1054,8 @@ void GameCommand_moveplayer(int request, int argc)
                                                        {
                                                                // set up
                                                                float team_id;
-                                                               float save = client.team_forced;
-                                                               client.team_forced = 0;
+                                                               int save = Player_GetForcedTeamIndex(client);
+                                                               Player_SetForcedTeamIndex(client, TEAM_FORCE_DEFAULT);
 
                                                                // find the team to move the player to
                                                                team_id = Team_ColorToTeam(destination);
@@ -1073,7 +1075,7 @@ void GameCommand_moveplayer(int request, int argc)
                                                                {
                                                                        balance = TeamBalance_CheckAllowedTeams(client);
                                                                }
-                                                               client.team_forced = save;
+                                                               Player_SetForcedTeamIndex(client, save);
 
                                                                // Check to see if the destination team is even available
                                                                switch (team_id)
@@ -1130,7 +1132,7 @@ void GameCommand_moveplayer(int request, int argc)
                                                                }
 
                                                                // If so, lets continue and finally move the player
-                                                               client.team_forced = 0;
+                                                               Player_SetForcedTeamIndex(client, TEAM_FORCE_DEFAULT);
                                                                if (MoveToTeam(client, Team_TeamToIndex(team_id), 6))
                                                                {
                                                                        successful = strcat(successful, (successful ? ", " : ""), playername(client, false));
@@ -1281,6 +1283,7 @@ void GameCommand_setbots(int request, int argc)
                        if (argc >= 2)
                        {
                                cvar_settemp("minplayers", "0");
+                               cvar_settemp("minplayers_per_team", "0");
                                cvar_settemp("bot_number", argv(1));
                                bot_fixcount();
                                return;
@@ -1312,7 +1315,7 @@ void GameCommand_shuffleteams(int request)
                        }
 
                        FOREACH_CLIENT(IS_PLAYER(it) || it.caplayer, {
-                               if (it.team_forced) {
+                               if (Player_HasRealForcedTeam(it)) {
                                        // 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